Skip to content

Commit

Permalink
Merge pull request #13 from mftaff/translations
Browse files Browse the repository at this point in the history
Translations for mailers and views
  • Loading branch information
mikker committed Feb 26, 2018
2 parents 0486005 + 51a907d commit 95c6fb8
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/passwordless/sessions_controller.rb
Expand Up @@ -60,7 +60,7 @@ def show
redirect_to main_app.root_path
end
rescue ExpiredSessionError
flash[:error] = I18n.t('.passwordless.sessions.session_expired')
flash[:error] = I18n.t('.passwordless.sessions.create.session_expired')
redirect_to main_app.root_path
end
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/passwordless/mailer.rb
Expand Up @@ -18,7 +18,7 @@ def magic_link(session)
email_field = @session.authenticatable.class.passwordless_email_field
mail(
to: @session.authenticatable.send(email_field),
subject: 'Your magic link ✨'
subject: I18n.t('passwordless.mailer.subject')
)
end
end
Expand Down
3 changes: 1 addition & 2 deletions app/views/passwordless/mailer/magic_link.text.erb
@@ -1,2 +1 @@
Here's your link:
<%= @magic_link %>
<%= I18n.t('passwordless.mailer.magic_link', link: @magic_link) %>
2 changes: 1 addition & 1 deletion app/views/passwordless/sessions/create.html.erb
@@ -1 +1 @@
<p>If we found you in the system, we've sent you an email.</p>
<p><%= I18n.t('passwordless.sessions.success.email_sent_if_record_found') %></p>
2 changes: 1 addition & 1 deletion app/views/passwordless/sessions/new.html.erb
@@ -1,5 +1,5 @@
<%= form_for @session, url: send(authenticatable_resource).sign_in_path do |f| %>
<% email_field_name = :"passwordless[#{@email_field}]" %>
<%= text_field_tag email_field_name, params.fetch(email_field_name, nil) %>
<%= f.submit 'Send magic link' %>
<%= f.submit I18n.t('passwordless.sessions.new.submit') %>
<% end %>
9 changes: 8 additions & 1 deletion config/locales/en.yml
Expand Up @@ -2,4 +2,11 @@
en:
passwordless:
sessions:
session_expired: 'Your session has expired, please sign in again.'
create:
session_expired: 'Your session has expired, please sign in again.'
email_sent_if_record_found: "If we found you in the system, we've sent you an email."
new:
submit: 'Send magic link'
mailer:
subject: "Your magic link ✨'"
magic_link: "Here's your link: %{link}"

0 comments on commit 95c6fb8

Please sign in to comment.