Skip to content

Commit

Permalink
Merge pull request #1060 from cwant/cwant/i18n_devise
Browse files Browse the repository at this point in the history
I18n for some of the devise related pages.
  • Loading branch information
fbacall authored Nov 25, 2024
2 parents b3dc1cb + f55c786 commit 4fb7cd5
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 10 deletions.
4 changes: 3 additions & 1 deletion app/views/devise/sessions/_omniauth_options.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<% if config.options[:logo] %>
<%= image_tag(config.options[:logo], class: "omniauth-logo omniauth-#{provider}") -%>
<% else %>
<%= "Log in with #{t("authentication.omniauth.providers.#{provider}", default: provider.to_s.titleize)}" -%>
<%= t('authentication.omniauth.log_in_with',
provider: t("authentication.omniauth.providers.#{provider}",
default: provider.to_s.titleize)) -%>
<% end %>
<% end -%>
<% end -%>
Expand Down
9 changes: 5 additions & 4 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="h4"><%= t('authentication.password.title') %></div>
<p><%= t('authentication.password.description') %></p>
<%= f.input :login, label: 'Email or username', autofocus: true %>
<%= f.input :password, input_html: { autocomplete: 'off' } %>
<%= f.input :login, label: t('authentication.password.email_or_username'), autofocus: true %>
<%= f.input :password, label: t('authentication.password.password'),
input_html: { autocomplete: 'off' } %>
<% if devise_mapping.rememberable? -%>
<%= f.input :remember_me, as: :boolean %>
<%= f.input :remember_me, label: t('authentication.password.remember_me'), as: :boolean %>
<% end -%>
<div class="actions">
<%= f.submit "Log in", :class => 'btn btn-primary' %>
<%= f.submit t('authentication.password.log_in'), :class => 'btn btn-primary' %>
</div>
<% end %>
<%= render "devise/shared/links" %>
Expand Down
15 changes: 10 additions & 5 deletions app/views/devise/shared/_links.html.erb
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<ul class="shared-links">
<%- if controller_name != 'sessions' %>
<li>Already on <%= TeSS::Config.site['title_short'] %>? <%= link_to 'Log in', new_session_path(resource_name) %></li>
<li><%= t('devise.links.already_on', title: TeSS::Config.site['title_short']) %>
<%= link_to t('devise.links.log_in'), new_session_path(resource_name) %></li>
<% end -%>

<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<li>New to <%= TeSS::Config.site['title_short'] %>? <%= link_to 'Register', new_registration_path(resource_name) %></li>
<li><%= t('devise.links.new_to', title: TeSS::Config.site['title_short']) %>
<%= link_to t('devise.links.register'), new_registration_path(resource_name) %></li>
<% end -%>

<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<li>Forgot your password? <%= link_to 'Request a reset', new_password_path(resource_name) %></li>
<li><%= t('devise.links.forgot_your_password') %>
<%= link_to t('devise.links.request_a_reset'), new_password_path(resource_name) %></li>
<% end -%>

<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<li>Didn’t receive confirmation instructions? <%= link_to 'Resend', new_confirmation_path(resource_name) %></li>
<li><%= t('devise.links.didnt_receive_confirmation_instructions') %>
<%= link_to t('devise.links.resend'), new_confirmation_path(resource_name) %></li>
<% end -%>

<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<li>Didn't receive unlock instructions? <%= link_to 'Resend', new_unlock_path(resource_name) %></li>
<li><%= t('devise.links.didnt_receive_unlock_instructions') %>
<%= link_to t('devise.links.resend'), new_unlock_path(resource_name) %></li>
<% end -%>
</ul>
10 changes: 10 additions & 0 deletions config/locales/devise.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ en:
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
unlocked: "Your account has been unlocked successfully. Please log in to continue."
links:
already_on: 'Already on %{title}?'
log_in: 'Log in'
new_to: 'New to %{title}?'
register: 'Register'
forgot_your_password: 'Forgot your password?'
request_a_reset: 'Request a reset'
didnt_receive_confirmation_instructions: "Didn’t receive confirmation instructions?"
didnt_receive_unlock_instructions: "Didn't receive unlock instructions?"
resend: 'Resend'
errors:
messages:
already_confirmed: "was already confirmed, please try logging in"
Expand Down
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -708,13 +708,18 @@ en:
password:
title: Login
description: ''
email_or_username: 'Email or username'
password: 'Password'
remember_me: 'Remember me'
log_in: 'Log in'
omniauth:
title: Institutional Login
description: ''
providers:
elixir_aai: LS Login
oidc: AAF (Australia)
oidc2: Tuakiri (NZ)
log_in_with: 'Log in with %{provider}'
ingestion:
categories:
events: 'Events'
Expand Down

0 comments on commit 4fb7cd5

Please sign in to comment.