diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 75be23d..634aea8 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -3,26 +3,34 @@ def sharing_notification(role) @role = role - mail(to: @role.user.email, - subject: _("You have been given access to a Data Management Plan")) + FastGettext.with_locale FastGettext.default_locale do + mail(to: @role.user.email, + subject: _("You have been given access to a Data Management Plan")) + end end def permissions_change_notification(role) @role = role - mail(to: @role.user.email, - subject: _("DMP permissions changed")) + FastGettext.with_locale FastGettext.default_locale do + mail(to: @role.user.email, + subject: _("DMP permissions changed")) + end end def project_access_removed_notification(user, plan) @user = user @plan = plan - mail(to: @user.email, - subject: _("DMP access removed")) + FastGettext.with_locale FastGettext.default_locale do + mail(to: @user.email, + subject: _("DMP access removed")) + end end def api_token_granted_notification(user) @user = user - mail(to: @user.email, - subject: _('API Permission Granted')) + FastGettext.with_locale FastGettext.default_locale do + mail(to: @user.email, + subject: _('API Permission Granted')) + end end end \ No newline at end of file diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb index 0a4d984..1d329fc 100644 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -1,5 +1,7 @@ -

<%= _("Welcome to %{application_name}") % {application_name: Rails.configuration.branding[:application][:name]} %>, <%= @email %>!

+<% FastGettext.with_locale FastGettext.default_locale do %> +

<%= _("Welcome to %{application_name}") % {application_name: Rails.configuration.branding[:application][:name]} %>, <%= @email %>!

-

<%= _("Thank you for registering. Please confirm your email address") %>:

+

<%= _("Thank you for registering. Please confirm your email address") %>:

-

<%= link_to _("Click here to confirm your account"), confirmation_url(@resource, :confirmation_token => @token) %> (<%= _("or copy") %> <%= confirmation_url(@resource, :confirmation_token => @token) %> <%= _("into your browser") %>).

\ No newline at end of file +

<%= link_to _("Click here to confirm your account"), confirmation_url(@resource, :confirmation_token => @token) %> (<%= _("or copy") %> <%= confirmation_url(@resource, :confirmation_token => @token) %> <%= _("into your browser") %>).

+<% end %> \ No newline at end of file diff --git a/app/views/devise/mailer/invitation_instructions.html.erb b/app/views/devise/mailer/invitation_instructions.html.erb index 7beb75d..b3366dc 100644 --- a/app/views/devise/mailer/invitation_instructions.html.erb +++ b/app/views/devise/mailer/invitation_instructions.html.erb @@ -1,7 +1,12 @@ -

<%= t('custom_devise.hello') %> <%= @resource.email %>!

+<% FastGettext.with_locale FastGettext.default_locale do %> +

<%= _("Hello") %> <%= @resource.email %>!

-

<%= t('custom_devise.colleague_invited_you') %> <%= link_to t('tool_title'), root_url %>

+

<%= _("A colleague has invited you to contribute to their Data Management Plan at ") %> <%= link_to Rails.configuration.branding[:application][:name], root_url %>

-

<%= link_to t('custom_devise.click_to_accept'), accept_invitation_url(@resource, :invitation_token => @token) %> <%= t('custom_devise.1st_part_copy') %> <%= accept_invitation_url(@resource, :invitation_token => @token) %> <%= t('custom_devise.2nd_part_copy') %>

+

<%= link_to _("Click here to accept the invitation"), accept_invitation_url(@resource, :invitation_token => @token) %> (<%= _("or copy") %> <%= accept_invitation_url(@resource, :invitation_token => @token) %> <%= _("into your browser") %>).

-<%= t('custom_devise.ignore_wont_be_created') %> \ No newline at end of file +

+ <%= _("If you don't want to accept the invitation, please ignore this email.") %>
+ <%= _("Your account won't be created until you access the link above and set your password.") %> +

+<% end %> \ No newline at end of file diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb index b4c0ac6..21ba9ff 100644 --- a/app/views/devise/mailer/reset_password_instructions.html.erb +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -1,7 +1,10 @@ -

<%= t('custom_devise.hello') %> <%= @resource.email %>!

+<% FastGettext.with_locale FastGettext.default_locale do %> +

<%= _("Hello") %> <%= @resource.email %>!

-

<%= t('custom_devise.1st_part_change_password') %> <%= link_to t('tool_title'), root_url %> <%= t('custom_devise.2nd_part_change_password') %>

+

<%= _("Someone has requested a link to change your") %> <%= link_to Rails.configuration.branding[:application][:name], root_url %> <%= _("password. You can do this through the link below.") %>

-

<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %>

+

<%= link_to _('Change my password'), edit_password_url(@resource, :reset_password_token => @token) %>

-<%= t('custom_devise.1st_part_change_password') %> +

<%= _("If you didn't request this, please ignore this email.") %>

+

<%= _("Your password won't change until you access the link above and create a new one.") %>

+<% end %> \ No newline at end of file diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb index 0346189..3787b7a 100644 --- a/app/views/devise/mailer/unlock_instructions.html.erb +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -1,7 +1,9 @@ -

<%= t('custom_devise.hello') %> <%= @resource.email %>!

+<% FastGettext.with_locale FastGettext.default_locale do %> +

<%= _("Hello") %> <%= @resource.email %>!

-

<%= t('custom_devise.1st_part_locked') %><%= link_to t('tool_title'), root_url %><%= t('custom_devise.2nd_part_locked') %>

+

<%= _("Your") %> <%= link_to Rails.configuration.branding[:application][:name], root_url %> <%= _("account has been locked due to an excessive number of unsuccessful sign in attempts.") %>

-

<%= t('custom_devise.click_to_unlock') %>

+

<%= _("Click the link below to unlock your account") %>:

-

<%= link_to t('custom_devise.unlock'), unlock_url(@resource, :unlock_token => @token) %>

\ No newline at end of file +

<%= link_to _("Unlock my account"), unlock_url(@resource, :unlock_token => @token) %>

+<% end %> \ No newline at end of file diff --git a/app/views/user_mailer/api_token_granted_notification.html.erb b/app/views/user_mailer/api_token_granted_notification.html.erb index 82eb955..bf752fd 100644 --- a/app/views/user_mailer/api_token_granted_notification.html.erb +++ b/app/views/user_mailer/api_token_granted_notification.html.erb @@ -1,6 +1,7 @@ -

<% _('Hello') %><%= @user.name %>

- - -

-<% _('You have been granted permission by your organisation to use our API.') %>"<%= link_to _('Your API token and instructions for using the API endpoints can be found here.'), controller: "users", action: "edit" %>". -

+<% FastGettext.with_locale FastGettext.default_locale do %> +

<% _('Hello') %> <%= @user.name %>

+ +

+ <% _('You have been granted permission by your organisation to use our API.') %>" <%= link_to _('Your API token and instructions for using the API endpoints can be found here.'), controller: "users", action: "edit" %>". +

+<% end %> \ No newline at end of file diff --git a/app/views/user_mailer/permissions_change_notification.html.erb b/app/views/user_mailer/permissions_change_notification.html.erb index f44b1fd..a0ef8fe 100644 --- a/app/views/user_mailer/permissions_change_notification.html.erb +++ b/app/views/user_mailer/permissions_change_notification.html.erb @@ -1,13 +1,15 @@ -

<%= _('Hello') %> <%= @role.user.name %>

+<% FastGettext.with_locale FastGettext.default_locale do %> +

<%= _('Hello') %> <%= @role.user.name %>

-<% -access_level = "read-only" -if @role.editor? - access_level = "editor" -end -if @role.administrator? - access_level = "co-owner" -end -%> + <% + access_level = "read-only" + if @role.editor? + access_level = "editor" + end + if @role.administrator? + access_level = "co-owner" + end + %> -

<%= ('Your permissions relating to') %>"<%= link_to @role.plan.title, url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: I18n.default_locale) %>"<%= _(' have changed. You now have') %><%= access_level %> <%= _('access.') %>

+

<%= _('Your permissions relating to') %> "<%= link_to @role.plan.title, url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: I18n.default_locale) %>" <%= _('have changed. You now have') %> <%= access_level %> <%= _('access.') %>

+<% end %> \ No newline at end of file diff --git a/app/views/user_mailer/project_access_removed_notification.html.erb b/app/views/user_mailer/project_access_removed_notification.html.erb index 778d50b..7ad6e31 100644 --- a/app/views/user_mailer/project_access_removed_notification.html.erb +++ b/app/views/user_mailer/project_access_removed_notification.html.erb @@ -1,3 +1,5 @@ -

<%= _('Hello') %><%= @user.name %>

+<% FastGettext.with_locale FastGettext.default_locale do %> +

<%= _('Hello') %> <%= @user.name %>

-

<%= _('Your access to ') %>"<%= @plan.title %>"<%= _(' has been removed.') %>

+

<%= _('Your access to') %> "<%= @plan.title %>" <%= _('has been removed.') %>

+<% end %> \ No newline at end of file diff --git a/app/views/user_mailer/sharing_notification.html.erb b/app/views/user_mailer/sharing_notification.html.erb index cccfddf..296d6b2 100644 --- a/app/views/user_mailer/sharing_notification.html.erb +++ b/app/views/user_mailer/sharing_notification.html.erb @@ -1,13 +1,14 @@ -

<%= _('Hello') %> <%= @role.user.name %>

+<% FastGettext.with_locale FastGettext.default_locale do %> +

<%= _('Hello') %> <%= @role.user.name %>

-<% -access_level = "read-only" -if @role.editor? - access_level = "editor" -elsif @role.administrator? - access_level = "co-owner" -end -%> + <% + access_level = "read-only" + if @role.editor? + access_level = "editor" + elsif @role.administrator? + access_level = "co-owner" + end + %> -

<%= _('You have been given ') %><%= access_level %><%= _(' access to') %><%= link_to @role.plan.title, url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: I18n.default_locale) %>".

- +

<%= _('You have been given') %> <%= access_level %> <%= _(' access to') %> "<%= link_to @role.plan.title, url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: I18n.default_locale) %>".

+<% end %>