From 8c6978c0cb2cabe81edde5aaeafdc2c8cb19d162 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 26 Aug 2021 09:50:28 +0200 Subject: [PATCH] feat(i18n): translate devise related emails --- .../confirmation_instructions.en.html.haml | 23 ++++++++++++++++++ .../devise_mailer/email_changed.en.html.haml | 14 +++++++++++ .../password_change.en.html.haml | 9 +++++++ .../reset_password_instructions.en.html.haml | 12 ++++++++++ .../unlock_instructions.en.html.haml | 15 ++++++++++++ .../notify_new_draft.en.html.haml | 24 +++++++++++++++++++ .../layouts/mailers/_signature.html.haml | 2 +- config/locales/en.yml | 2 ++ config/locales/fr.yml | 2 ++ 9 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 app/views/devise_mailer/confirmation_instructions.en.html.haml create mode 100644 app/views/devise_mailer/email_changed.en.html.haml create mode 100644 app/views/devise_mailer/password_change.en.html.haml create mode 100644 app/views/devise_mailer/reset_password_instructions.en.html.haml create mode 100644 app/views/devise_mailer/unlock_instructions.en.html.haml create mode 100644 app/views/dossier_mailer/notify_new_draft.en.html.haml diff --git a/app/views/devise_mailer/confirmation_instructions.en.html.haml b/app/views/devise_mailer/confirmation_instructions.en.html.haml new file mode 100644 index 000000000..ec5d38fd4 --- /dev/null +++ b/app/views/devise_mailer/confirmation_instructions.en.html.haml @@ -0,0 +1,23 @@ +-# ugly hack to know if the mail is creation confirmation or a password change confirmation +- if @user.unconfirmed_email.nil? + - content_for(:title, 'Activate account') + + %p + Dear Sir or Madam, + + %p + You have entered your details to create an account on #{APPLICATION_NAME}. To confirm your email and finish creating your account, select the following link: + - link = confirmation_url(@user, confirmation_token: @token, procedure_id: @procedure&.id) + = link_to(link, link) + +- else + - content_for(:title, "Change email address") + + %p + Dear Sir or Madam, + + %p + To confirm your account email change on #{APPLICATION_NAME}, select the following link: + = link_to(confirmation_url(@user, confirmation_token: @token), confirmation_url(@user, confirmation_token: @token)) + += render partial: "layouts/mailers/signature" diff --git a/app/views/devise_mailer/email_changed.en.html.haml b/app/views/devise_mailer/email_changed.en.html.haml new file mode 100644 index 000000000..644a59424 --- /dev/null +++ b/app/views/devise_mailer/email_changed.en.html.haml @@ -0,0 +1,14 @@ +- content_for(:title, 'New email address') + +%p + Dear Sir or Madam, + +- unconfirmed_email = @resource.try(:unconfirmed_email?) +- if unconfirmed_email.present? + %p + We recieved a request to change the email address associated with your account #{@email} on #{APPLICATION_NAME}. The new email address will be #{unconfirmed_email}. +- else + %p + A change to the email address associated with your account #{@email} was made on #{APPLICATION_NAME}. You can now connect with the email address #{@resource.email}. + += render partial: "layouts/mailers/signature" diff --git a/app/views/devise_mailer/password_change.en.html.haml b/app/views/devise_mailer/password_change.en.html.haml new file mode 100644 index 000000000..1cdfac54d --- /dev/null +++ b/app/views/devise_mailer/password_change.en.html.haml @@ -0,0 +1,9 @@ +- content_for(:title, 'New password') + +%p + Dear Sir or Madam, + +%p + A request to change your password on #{APPLICATION_NAME} for the account #{@resource.email} was successfully processed. + += render partial: "layouts/mailers/signature" diff --git a/app/views/devise_mailer/reset_password_instructions.en.html.haml b/app/views/devise_mailer/reset_password_instructions.en.html.haml new file mode 100644 index 000000000..be27aee1a --- /dev/null +++ b/app/views/devise_mailer/reset_password_instructions.en.html.haml @@ -0,0 +1,12 @@ +%p + Dear Sir or Madam, + +%p + Someone has requested to change your account password on #{APPLICATION_NAME}. To define a new password, select the following link: + += round_button 'Change the password', edit_password_url(@resource, reset_password_token: @token), :primary + +%p + If you didn't request this, please ignore this email. Your password won't change. + += render partial: "layouts/mailers/signature" diff --git a/app/views/devise_mailer/unlock_instructions.en.html.haml b/app/views/devise_mailer/unlock_instructions.en.html.haml new file mode 100644 index 000000000..ead124008 --- /dev/null +++ b/app/views/devise_mailer/unlock_instructions.en.html.haml @@ -0,0 +1,15 @@ +- content_for(:title, 'Reactivate account') + +%p + Dear Sir or Madam, + +%p + Someone made too many unsuccessful attempts to connect to your account #{@resource.email} on #{APPLICATION_NAME}. + As a security measure, we temporarily locked access to your account. + +%p + To unlock access to your account, select the following link: + +%p= link_to 'Unlock account', unlock_url(@resource, unlock_token: @token) + += render partial: "layouts/mailers/signature" diff --git a/app/views/dossier_mailer/notify_new_draft.en.html.haml b/app/views/dossier_mailer/notify_new_draft.en.html.haml new file mode 100644 index 000000000..f3e6b1e8f --- /dev/null +++ b/app/views/dossier_mailer/notify_new_draft.en.html.haml @@ -0,0 +1,24 @@ +- content_for :procedure_logo do + = render 'layouts/mailers/logo', url: @logo_url + +%p + Dear Sir or Madam, + +%p + You started filling a File on the procedure: + = succeed '.' do + %strong « #{@dossier.procedure.libelle} » + +%p + You can access your File, to review or complete, by clicking on the following button: + += round_button('Access your File', dossier_url(@dossier), :primary) + +- if @dossier.procedure.auto_archive_on + %p + Your File needs to be submitted before #{procedure_auto_archive_datetime(@dossier.procedure)}. + += render 'layouts/mailers/signature' + +- content_for :footer do + = render 'layouts/mailers/service_footer', service: @service, dossier: @dossier diff --git a/app/views/layouts/mailers/_signature.html.haml b/app/views/layouts/mailers/_signature.html.haml index 985288c7b..7273cd7b5 100644 --- a/app/views/layouts/mailers/_signature.html.haml +++ b/app/views/layouts/mailers/_signature.html.haml @@ -1,5 +1,5 @@ %p - Bonne journée, + = t(:best_regards, scope: [:layouts, :signature]) %br - if defined?(service) && service && service.nom.present? = service.nom diff --git a/config/locales/en.yml b/config/locales/en.yml index 95f01432b..7afc13b1f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -53,6 +53,8 @@ en: line3: administrative forms. locale_dropdown: languages: "Languages" + signature: + best_regards: Best Regards, views: commencer: show: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 5a2797a64..e446339a3 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -43,6 +43,8 @@ fr: line3: administratifs dématérialisés. locale_dropdown: languages: "Langues" + signature: + best_regards: Bonne journée, views: commencer: show: