From 540e5acabac2c3c6f0664668e58f06c302dbb9b6 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 5 Feb 2022 19:26:04 +0100 Subject: [PATCH] Add translations for account settings --- app/views/devise/registrations/edit.haml | 6 ++--- app/views/modal/_password.haml | 13 ++++------- app/views/settings/_account.haml | 29 +++++++++++------------- config/locales/activerecord.en.yml | 11 +++++++++ 4 files changed, 32 insertions(+), 27 deletions(-) diff --git a/app/views/devise/registrations/edit.haml b/app/views/devise/registrations/edit.haml index 2435e936..fd185441 100644 --- a/app/views/devise/registrations/edit.haml +++ b/app/views/devise/registrations/edit.haml @@ -1,4 +1,4 @@ -= render 'settings/account' += render "settings/account" -- provide(:title, generate_title('Account Settings')) -- parent_layout 'user/settings' +- provide(:title, generate_title(t(".title"))) +- parent_layout "user/settings" diff --git a/app/views/modal/_password.haml b/app/views/modal/_password.haml index e6fc37c4..470db39e 100644 --- a/app/views/modal/_password.haml +++ b/app/views/modal/_password.haml @@ -2,15 +2,12 @@ .modal-dialog .modal-content .modal-header - %h5.modal-title#modal-passwd-label= t 'views.settings.account.modal.title' + %h5.modal-title#modal-passwd-label= t(".title") %button.close{ data: { dismiss: :modal }, type: :button } %span{ aria: { hidden: true } } × - %span.sr-only= t 'views.actions.close' + %span.sr-only= t("voc.close") .modal-body - = f.password_field :current_password, - autocomplete: :off, - label: t('views.settings.account.password_current'), - help: t('views.settings.account.password_current_help') + = f.password_field :current_password, autocomplete: :off .modal-footer - %button.btn.btn-default{ data: { dismiss: :modal }, type: :button }= t 'views.actions.cancel' - %button.btn.btn-primary{ type: :submit }= t 'views.actions.save' + %button.btn.btn-default{ data: { dismiss: :modal }, type: :button }= t("voc.cancel") + = f.primary diff --git a/app/views/settings/_account.haml b/app/views/settings/_account.haml index 54b424b0..0973062e 100644 --- a/app/views/settings/_account.haml +++ b/app/views/settings/_account.haml @@ -1,29 +1,26 @@ .card .card-body - = bootstrap_form_for(resource, as: resource_name, url: '/settings/account', html: { method: :put }) do |f| - = render 'modal/password', f: f + = bootstrap_form_for(resource, as: resource_name, url: "/settings/account", html: { method: :put }) do |f| + = render "modal/password", f: f + = render "devise/shared/error_messages", resource: resource - = render 'devise/shared/error_messages', resource: resource + = f.text_field :screen_name, autofocus: true - = f.text_field :screen_name, autofocus: true, label: t('views.settings.account.username') - - = f.email_field :email, label: t('views.settings.account.email') + = f.email_field :email - if devise_mapping.confirmable? && resource.pending_reconfirmation? - %div= raw t('views.settings.account.email_confirm', resource: resource.unconfirmed_email) + .alert.alert-info= raw t(".email_confirm", resource: resource.unconfirmed_email) - = f.password_field :password, autocomplete: :off, label: t('views.settings.account.password'), help: t('views.settings.account.password_help') - = f.password_field :password_confirmation, autocomplete: :off, label: t('views.settings.account.password_confirm') + = f.password_field :password, autocomplete: :off, help: t(".help.password") + = f.password_field :password_confirmation, autocomplete: :off - %button.btn.btn-primary{ data: { target: '#modal-passwd', toggle: :modal, type: :button } } - = t 'views.actions.save' + %button.btn.btn-primary{ data: { target: "#modal-passwd", toggle: :modal, type: :button } } + = t("voc.save") %hr/ %p - = t 'views.settings.account.unsatisfied' - = button_to t('views.settings.account.delete'), '/settings/account', data: { confirm: 'Are you sure?' }, method: :delete, class: 'btn btn-danger btn-xs' + = t(".delete.heading") + = button_to t(".delete.action"), "/settings/account", data: { confirm: t(".delete.confirm") }, method: :delete, class: "btn btn-danger btn-xs" - = link_to t('views.settings.account.back'), :back - -.visible-xs= render 'shared/links' +.visible-xs= render "shared/links" diff --git a/config/locales/activerecord.en.yml b/config/locales/activerecord.en.yml index 1839a6d2..b9b5f82b 100644 --- a/config/locales/activerecord.en.yml +++ b/config/locales/activerecord.en.yml @@ -20,10 +20,19 @@ en: service: post_tag: "Tag" user: + current_password: "Current password" + email: "Email" + login: "Username or Email" + password: "Password" + password_confirmation: "Confirm your password" profile_picture: "Profile picture" profile_header: "Profile header" + screen_name: "Username" show_foreign_themes: "Render other user themes when visiting their profile" help: + user: + email: "Don't forget to check your spam folder in case our mail might have landed there!" + current_password: "We need your current password to confirm your changes" profile: motivation_header: "Shown in the header of the question box on your profile. Motivate users to ask you questions!" services/twitter: @@ -31,6 +40,8 @@ en: helpers: submit: user: + new: "Sign in" + create: :voc.register update: :voc.save profile: update: :voc.save