Skip to content

Fix: notify locale on gpg key email page

What does this MR do and why?

Before proceeding

Why I didn't update the string like the documentation suggested.

The reason was that in this case, all of the strings are wrapped by a p tag, if I update the code like the documentation suggested it would be:

- greeting = content_tag(:p, _("Hi, %{user}"))
- gpg_key_added = content_tag(:p, _("A new GPG key was added to your account:"))
-# Omit some content
= s_("Notify|%{greeting} %{gpg_key_added} %{fingerprint} %{notice}")

It would be very difficult for the translator to translate the sentence.

Reason

Right now the email template for new gpg key notification can only be sent in English

Result

  • in this MR I updated the template with i18n enabled strings instead of hardcoded strings. After this MR it will be able to send languages the user prefers.
  • I also updated the variable referencing to use the same parameter that passed to the method instead of instance member.

/cc @prajnamas @orozot @qk44077907

Screenshots or screen recordings

Before

image

After

image

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

  1. Go to you gdk
  2. Login
  3. Go to your GPG settings
  4. Add a GPG key
  5. Open gdk/rails/letter_opener/ to preview the email
  6. Observe.

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Wu Jeremy

Merge request reports