Make mail and mailer translatable
authorTusooa Zhu <tusooa@kazv.moe>
Wed, 2 Mar 2022 00:17:11 +0000 (19:17 -0500)
committerFloatingGhost <hannah@coffee-and-dreams.uk>
Wed, 29 Jun 2022 19:45:05 +0000 (20:45 +0100)
lib/pleroma/web/templates/email/digest.html.eex
lib/pleroma/web/templates/mailer/subscription/unsubscribe_failure.html.eex
lib/pleroma/web/templates/mailer/subscription/unsubscribe_success.html.eex
lib/pleroma/web/views/email_view.ex
lib/pleroma/web/views/mailer/subscription_view.ex
priv/gettext/static_pages.pot

index 60eceff221d665ea37cdb3c78f0db8fa304331b3..1efc76e1ad880076b17807163a223dedab802624 100644 (file)
                                                                                                <div
                                                                                                        style="font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;line-height: 14px; color: <%= @styling.header_color %>;">
                                                                                                        <p style="line-height: 36px; text-align: center; margin: 0;"><span
-                                                                                                                       style="font-size: 30px; color: <%= @styling.header_color %>;">Hey <%= @user.nickname %>, here is what you've missed!</span></p>
+                                                                                                                       style="font-size: 30px; color: <%= @styling.header_color %>;"><%= Gettext.dpgettext("static_pages", "digest email header line", "Hey %{nickname}, here is what you've missed!", nickname: @user.nickname) %></span></p>
                                                                                                </div>
                                                                                        </div>
                                                                                        <!--[if mso]></td></tr></table><![endif]-->
                                                                                                <div
                                                                                                        style="font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 12px; line-height: 14px; color: <%= @styling.text_color %>;">
                                                                                                        <p style="font-size: 12px; line-height: 24px; text-align: center; margin: 0;"><span
-                                                                                                                       style="font-size: 20px;"><%= length(@followers) %> New Followers</span><span
+                                                                                                                       style="font-size: 20px;"><%= Gettext.dpngettext("static_pages", "new followers count header", "%{count} New Follower", "%{count} New Followers", length(@followers), count: length(@followers)) %></span><span
                                                                                                                        style="font-size: 20px; line-height: 24px;"></span></p>
                                                                                                </div>
                                                                                        </div>
                                                                                                style="color:<%= @styling.text_color %>;font-family:Arial, 'Helvetica Neue', Helvetica, sans-serif;line-height:120%;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px;">
                                                                                                <p
                                                                                                        style="font-size: 12px; line-height: 16px; text-align: center; color: <%= @styling.text_color %>; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; margin: 0;">
-                                                                                                       <span style="font-size: 14px;">You have received this email because you have signed up to receive digest emails from <b><%= @instance %></b> Pleroma instance.</span></p>
+                                                                                                       <span style="font-size: 14px;"><%= raw Gettext.dpgettext("static_pages", "digest email sending reason", "You have received this email because you have signed up to receive digest emails from <b>%{instance}</b> Pleroma instance.", instance: safe_to_string(html_escape(@instance))) %></span></p>
                                                                                                <p
                                                                                                        style="font-size: 12px; line-height: 14px; text-align: center; color: <%= @styling.text_color %>; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; margin: 0;">
                                                                                                         </p>
                                                                                                <p
                                                                                                        style="font-size: 12px; line-height: 16px; text-align: center; color: <%= @styling.text_color %>; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; margin: 0;">
-                                                                                                       <span style="font-size: 14px;">The email address you are subscribed as is <a href="mailto:<%= @user.email %>" style="color: <%= @styling.link_color %>;text-decoration: none;"><%= @user.email %></a>. </span></p>
+                                                                                                       <span style="font-size: 14px;"><%= raw Gettext.dpgettext("static_pages", "digest email receiver address", "The email address you are subscribed as is <a href='mailto:%{@user.email}' style='color: %{color};text-decoration: none;'>%{email}</a>. ", color: safe_to_string(html_escape(@styling.link_color)), email: safe_to_string(html_escape(@user.email))) %></span></p>
                                                                                                <p
                                                                                                        style="font-size: 12px; line-height: 16px; text-align: center; color: <%= @styling.text_color %>; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; margin: 0;">
-                                                                                                       <span style="font-size: 14px;">To unsubscribe, please go <%= link "here", style: "color: #{@styling.link_color};text-decoration: none;", to: @unsubscribe_link %>.</span></p>
+                                                                                                       <span style="font-size: 14px;"><%= raw Gettext.dpgettext("static_pages", "digest email unsubscribe action", "To unsubscribe, please go %{here}.", here: safe_to_string link(Gettext.dpgettext("static_pages", "digest email unsubscribe action link text", "here"), style: "color: #{@styling.link_color};text-decoration: none;", to: @unsubscribe_link)) %></span></p>
                                                                                        </div>
                                                                                        <!--[if mso]></td></tr></table><![endif]-->
                                                                                        <!--[if (!mso)&(!IE)]><!-->
index 7b476f02ddfd30b6bbdf9305646d1ad664afe412..df090ffcddec75aad917e43362ca95a41292b4a6 100644 (file)
@@ -1 +1 @@
-<h1>UNSUBSCRIBE FAILURE</h1>
+<h1><%= Gettext.dpgettext("static_pages", "mailer unsubscribe failed message", "UNSUBSCRIBE FAILURE") %></h1>
index 6dfa2c1859352de9345a89495586f8d25392e6e8..cbce495d4460ae67f683cb83640fea741f21cdcc 100644 (file)
@@ -1 +1 @@
-<h1>UNSUBSCRIBE SUCCESSFUL</h1>
+<h1><%= Gettext.dpgettext("static_pages", "mailer unsubscribe successful message", "UNSUBSCRIBE SUCCESSFUL") %></h1>
index f7659b994f593bb9f63f0408f747933fa7e4899e..2ef049d27b387344e82169604318f83e6046e0f2 100644 (file)
@@ -6,6 +6,7 @@ defmodule Pleroma.Web.EmailView do
   use Pleroma.Web, :view
   import Phoenix.HTML
   import Phoenix.HTML.Link
+  alias Pleroma.Web.Gettext
 
   def avatar_url(user) do
     Pleroma.User.avatar_url(user)
index 1dc80987b9cacae717582f7f9cf738baa176c2ee..01e96c61ccb2dfaf5724743caf85cbc3d37d9d63 100644 (file)
@@ -4,4 +4,5 @@
 
 defmodule Pleroma.Web.Mailer.SubscriptionView do
   use Pleroma.Web, :view
+  alias Pleroma.Web.Gettext
 end
index 1bde0099db6348ed322c0c1652108dfac4a7f900..b76641e283be3e951d83ff4f40584f24ea1eeff8 100644 (file)
@@ -359,3 +359,53 @@ msgstr ""
 msgctxt "static fe profile page remote follow button"
 msgid "Remote follow"
 msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/email/digest.html.eex:163
+msgctxt "digest email header line"
+msgid "Hey %{nickname}, here is what you've missed!"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/email/digest.html.eex:544
+msgctxt "digest email receiver address"
+msgid "The email address you are subscribed as is <a href='mailto:%{@user.email}' style='color: %{color};text-decoration: none;'>%{email}</a>. "
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/email/digest.html.eex:538
+msgctxt "digest email sending reason"
+msgid "You have received this email because you have signed up to receive digest emails from <b>%{instance}</b> Pleroma instance."
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/email/digest.html.eex:547
+msgctxt "digest email unsubscribe action"
+msgid "To unsubscribe, please go %{here}."
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/email/digest.html.eex:547
+msgctxt "digest email unsubscribe action link text"
+msgid "here"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/mailer/subscription/unsubscribe_failure.html.eex:1
+msgctxt "mailer unsubscribe failed message"
+msgid "UNSUBSCRIBE FAILURE"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/mailer/subscription/unsubscribe_success.html.eex:1
+msgctxt "mailer unsubscribe successful message"
+msgid "UNSUBSCRIBE SUCCESSFUL"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/email/digest.html.eex:385
+msgctxt "new followers count header"
+msgid "%{count} New Follower"
+msgid_plural "%{count} New Followers"
+msgstr[0] ""
+msgstr[1] ""