From 04787793f4df80c4f979a58afcd7ae12f00e7543 Mon Sep 17 00:00:00 2001 From: echarp Date: Fri, 10 May 2019 18:06:39 +0200 Subject: [PATCH] Translated devise views --- app/views/devise/confirmations/new.html.haml | 4 +-- .../confirmation_instructions.html.haml | 7 +++-- .../devise/mailer/email_changed.html.haml | 9 +++---- .../devise/mailer/password_change.html.haml | 5 ++-- .../reset_password_instructions.html.haml | 11 ++++---- .../mailer/unlock_instructions.html.haml | 9 +++---- app/views/devise/passwords/edit.html.haml | 11 ++++---- app/views/devise/passwords/new.html.haml | 4 +-- app/views/devise/registrations/edit.html.haml | 27 +++++++++---------- app/views/devise/registrations/new.html.haml | 7 +++-- app/views/devise/sessions/new.html.haml | 9 +++---- app/views/devise/shared/_links.html.haml | 12 ++++----- app/views/devise/unlocks/new.html.haml | 4 +-- app/views/moderations/index.html.haml | 6 ++++- 14 files changed, 59 insertions(+), 66 deletions(-) diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml index 2382fc32..cb4c1d7c 100644 --- a/app/views/devise/confirmations/new.html.haml +++ b/app/views/devise/confirmations/new.html.haml @@ -1,4 +1,4 @@ -%h2 Resend confirmation instructions +%h2= t('.resend_confirmation_instructions') = form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| = render "devise/shared/error_messages", resource: resource .field @@ -6,5 +6,5 @@ %br/ = f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) .actions - = f.submit "Resend confirmation instructions" + = f.submit t('.resend_confirmation_instructions') = render "devise/shared/links" diff --git a/app/views/devise/mailer/confirmation_instructions.html.haml b/app/views/devise/mailer/confirmation_instructions.html.haml index 27d48e6d..46706c40 100644 --- a/app/views/devise/mailer/confirmation_instructions.html.haml +++ b/app/views/devise/mailer/confirmation_instructions.html.haml @@ -1,4 +1,3 @@ -%p - Welcome #{@email}! -%p You can confirm your account email through the link below: -%p= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) +%p= t('.greeting', recipient: @email) +%p= t('.instruction') +%p= link_to t('.action'), confirmation_url(@resource, confirmation_token: @token) diff --git a/app/views/devise/mailer/email_changed.html.haml b/app/views/devise/mailer/email_changed.html.haml index 94ebba05..8ae4d38a 100644 --- a/app/views/devise/mailer/email_changed.html.haml +++ b/app/views/devise/mailer/email_changed.html.haml @@ -1,8 +1,5 @@ -%p - Hello #{@email}! +%p= t('.greeting', recipient: @email) - if @resource.try(:unconfirmed_email?) - %p - We're contacting you to notify you that your email is being changed to #{@resource.unconfirmed_email}. + %p= t('.message', email: @resource.unconfirmed_email) - else - %p - We're contacting you to notify you that your email has been changed to #{@resource.email}. + %p= t('.message', email: @resource.email) diff --git a/app/views/devise/mailer/password_change.html.haml b/app/views/devise/mailer/password_change.html.haml index ab7c04c4..ebb43d00 100644 --- a/app/views/devise/mailer/password_change.html.haml +++ b/app/views/devise/mailer/password_change.html.haml @@ -1,3 +1,2 @@ -%p - Hello #{@resource.email}! -%p We're contacting you to notify you that your password has been changed. +%p= t('.greeting', recipient: @resource.email) +%p= t('.message') diff --git a/app/views/devise/mailer/reset_password_instructions.html.haml b/app/views/devise/mailer/reset_password_instructions.html.haml index 0711cd5a..ccc4aa55 100644 --- a/app/views/devise/mailer/reset_password_instructions.html.haml +++ b/app/views/devise/mailer/reset_password_instructions.html.haml @@ -1,6 +1,5 @@ -%p - Hello #{@resource.email}! -%p Someone has requested a link to change your password. You can do this through the link below. -%p= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) -%p If you didn't request this, please ignore this email. -%p Your password won't change until you access the link above and create a new one. +%p= t('.greeting', recipient: @resource.email) +%p= t('.instruction') +%p= link_to t('.action'), edit_password_url(@resource, reset_password_token: @token) +%p= t('.instruction_2') +%p= t('.instruction_3') diff --git a/app/views/devise/mailer/unlock_instructions.html.haml b/app/views/devise/mailer/unlock_instructions.html.haml index 282c98a2..d68bf7c7 100644 --- a/app/views/devise/mailer/unlock_instructions.html.haml +++ b/app/views/devise/mailer/unlock_instructions.html.haml @@ -1,5 +1,4 @@ -%p - Hello #{@resource.email}! -%p Your account has been locked due to an excessive number of unsuccessful sign in attempts. -%p Click the link below to unlock your account: -%p= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) +%p= t('.greeting', recipient: @resource.email) +%p= t('.message') +%p= t('.instruction') +%p= link_to t('.action'), unlock_url(@resource, unlock_token: @token) diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index acaf13a4..f492ff89 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -1,19 +1,18 @@ -%h2 Change your password +%h2= t('.change_your_password') = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| = render "devise/shared/error_messages", resource: resource = f.hidden_field :reset_password_token .field - = f.label :password, "New password" + = f.label :password, t('.new_password') %br/ - if @minimum_password_length - %em - (#{@minimum_password_length} characters minimum) + %em= t('devise.shared.minimum_password_length', count: @minimum_password_length) %br/ = f.password_field :password, autofocus: true, autocomplete: "new-password" .field - = f.label :password_confirmation, "Confirm new password" + = f.label :password_confirmation, t('.confirm_new_password') %br/ = f.password_field :password_confirmation, autocomplete: "off" .actions - = f.submit "Change my password" + = f.submit t('.change_my_password') = render "devise/shared/links" diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml index 60984ffa..39936f3d 100644 --- a/app/views/devise/passwords/new.html.haml +++ b/app/views/devise/passwords/new.html.haml @@ -1,4 +1,4 @@ -%h2 Forgot your password? +%h2= t('.forgot_your_password') = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| = render "devise/shared/error_messages", resource: resource .field @@ -6,5 +6,5 @@ %br/ = f.email_field :email, autofocus: true, autocomplete: "email" .actions - = f.submit "Send me reset password instructions" + = f.submit t('.send_me_reset_password_instructions') = render "devise/shared/links" diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index 5dd45ec9..81c35533 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -1,36 +1,35 @@ -%h2 - Edit #{resource_name.to_s.humanize} -= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| +%h2= t('.title', resource: resource.model_name.human) += form_for(resource, as: resource_name, url: send("#{resource_name}_registration_path"), html: { method: :put }) do |f| = render "devise/shared/error_messages", resource: resource .field = f.label :email %br/ = f.email_field :email, autofocus: true, autocomplete: "email" - if devise_mapping.confirmable? && resource.pending_reconfirmation? - %div - Currently waiting confirmation for: #{resource.unconfirmed_email} + %div= t('.currently_waiting_confirmation_for_email', email: resource.unconfirmed_email) .field = f.label :password - %i (leave blank if you don't want to change it) + %i + (#{t('.leave_blank_if_you_don_t_want_to_change_it')}) %br/ = f.password_field :password, autocomplete: "new-password" - if @minimum_password_length %br/ - %em - = @minimum_password_length - characters minimum + %em= t('devise.shared.minimum_password_length', count: @minimum_password_length) .field = f.label :password_confirmation %br/ = f.password_field :password_confirmation, autocomplete: "new-password" .field = f.label :current_password - %i (we need your current password to confirm your changes) + %i + (#{t('.we_need_your_current_password_to_confirm_your_changes')}) %br/ = f.password_field :current_password, autocomplete: "current-password" .actions - = f.submit "Update" -%h3 Cancel my account + = f.submit t('.update') +%h3= t('.cancel_my_account') %p - Unhappy? #{button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete} -= link_to "Back", :back + = t('.unhappy') + = button_to t('.cancel_my_account'), send("#{resource_name}_registration_path"), data: { confirm: t('.are_you_sure') }, method: :delete += link_to t('devise.shared.links.back'), :back diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 0f9c210a..21fec96c 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -1,4 +1,4 @@ -%h2 Sign up +%h2= t('.sign_up') = form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| = render "devise/shared/error_messages", resource: resource .field @@ -8,8 +8,7 @@ .field = f.label :password - if @minimum_password_length - %em - (#{@minimum_password_length} characters minimum) + %em= t('devise.shared.minimum_password_length', count: @minimum_password_length) %br/ = f.password_field :password, autocomplete: "new-password" .field @@ -17,5 +16,5 @@ %br/ = f.password_field :password_confirmation, autocomplete: "new-password" .actions - = f.submit "Sign up" + = f.submit t('.sign_up') = render "devise/shared/links" diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 9045c0d4..74746087 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -1,18 +1,17 @@ -%h2= t '.title' +%h2= t('.sign_in') = form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| .field.login = f.label :login %br/ - = f.text_field :login, autofocus: true, autocomplete: 'login' + = f.email_field :login, autofocus: true, autocomplete: "login" .field.password = f.label :password %br/ - = f.password_field :password, autocomplete: 'current-password' + = f.password_field :password, autocomplete: "current-password" - if devise_mapping.rememberable? .field = f.label :remember_me = f.check_box :remember_me .actions = f.submit t('.sign_in') - -= render 'devise/shared/links' += render "devise/shared/links" diff --git a/app/views/devise/shared/_links.html.haml b/app/views/devise/shared/_links.html.haml index d0ebcbb5..5577592e 100644 --- a/app/views/devise/shared/_links.html.haml +++ b/app/views/devise/shared/_links.html.haml @@ -1,19 +1,19 @@ - if controller_name != 'sessions' - = link_to "Log in", new_session_path(resource_name) + = link_to t(".sign_in"), new_session_path(resource_name) %br/ - if devise_mapping.registerable? && controller_name != 'registrations' - = link_to "Sign up", new_registration_path(resource_name) + = link_to t(".sign_up"), new_registration_path(resource_name) %br/ - if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' - = link_to "Forgot your password?", new_password_path(resource_name) + = link_to t(".forgot_your_password"), new_password_path(resource_name) %br/ - if devise_mapping.confirmable? && controller_name != 'confirmations' - = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) + = link_to t('.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name) %br/ - if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' - = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) + = link_to t('.didn_t_receive_unlock_instructions'), new_unlock_path(resource_name) %br/ - if devise_mapping.omniauthable? - resource_class.omniauth_providers.each do |provider| - = link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) + = link_to t('.sign_in_with_provider', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider) %br/ diff --git a/app/views/devise/unlocks/new.html.haml b/app/views/devise/unlocks/new.html.haml index bd4ace46..f3816151 100644 --- a/app/views/devise/unlocks/new.html.haml +++ b/app/views/devise/unlocks/new.html.haml @@ -1,4 +1,4 @@ -%h2 Resend unlock instructions +%h2= t('.resend_unlock_instructions') = form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| = render "devise/shared/error_messages", resource: resource .field @@ -6,5 +6,5 @@ %br/ = f.email_field :email, autofocus: true, autocomplete: "email" .actions - = f.submit "Resend unlock instructions" + = f.submit t('.resend_unlock_instructions') = render "devise/shared/links" diff --git a/app/views/moderations/index.html.haml b/app/views/moderations/index.html.haml index dc647b66..5254d76b 100644 --- a/app/views/moderations/index.html.haml +++ b/app/views/moderations/index.html.haml @@ -88,7 +88,11 @@ author: "#{note.author.firstname} #{note.author.lastname}", date: l(note.date, format: :at) rescue nil -.logout +.actions + = link_to edit_user_registration_path do + %em.fa.fa-lock + = t('change_my_password', scope: 'devise.passwords.edit') + \| = link_to destroy_user_session_path, method: :delete do %em.fa.fa-sign-out-alt = t 'logout'