From cadca083ea2a12a0e97fbd5e0e4fbae26b5d79a3 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Mon, 28 Feb 2022 11:07:28 -0500 Subject: [PATCH] Make mfa pages translatable --- lib/pleroma/web/o_auth/mfa_view.ex | 1 + .../templates/o_auth/mfa/recovery.html.eex | 8 ++-- .../web/templates/o_auth/mfa/totp.html.eex | 8 ++-- priv/gettext/static_pages.pot | 48 +++++++++++++++++++ 4 files changed, 57 insertions(+), 8 deletions(-) diff --git a/lib/pleroma/web/o_auth/mfa_view.ex b/lib/pleroma/web/o_auth/mfa_view.ex index 3d473f29c..952c90efe 100644 --- a/lib/pleroma/web/o_auth/mfa_view.ex +++ b/lib/pleroma/web/o_auth/mfa_view.ex @@ -6,6 +6,7 @@ defmodule Pleroma.Web.OAuth.MFAView do use Pleroma.Web, :view import Phoenix.HTML.Form alias Pleroma.MFA + alias Pleroma.Web.Gettext def render("mfa_response.json", %{token: token, user: user}) do %{ diff --git a/lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex b/lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex index b9daa8d8b..e45d13bdf 100644 --- a/lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex +++ b/lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex @@ -5,11 +5,11 @@ <% end %> -

Two-factor recovery

+

<%= Gettext.dpgettext("static_pages", "mfa recover page title", "Two-factor recovery") %>

<%= form_for @conn, Routes.mfa_verify_path(@conn, :verify), [as: "mfa"], fn f -> %>
- <%= label f, :code, "Recovery code" %> + <%= label f, :code, Gettext.dpgettext("static_pages", "mfa recover recovery code prompt", "Recovery code") %> <%= text_input f, :code, [autocomplete: false, autocorrect: "off", autocapitalize: "off", autofocus: true, spellcheck: false] %> <%= hidden_input f, :mfa_token, value: @mfa_token %> <%= hidden_input f, :state, value: @state %> @@ -17,8 +17,8 @@ <%= hidden_input f, :challenge_type, value: "recovery" %>
-<%= submit "Verify" %> +<%= submit Gettext.dpgettext("static_pages", "mfa recover verify recovery code button", "Verify") %> <% end %> "> - Enter a two-factor code + <%= Gettext.dpgettext("static_pages", "mfa recover use 2fa code link", "Enter a two-factor code") %> diff --git a/lib/pleroma/web/templates/o_auth/mfa/totp.html.eex b/lib/pleroma/web/templates/o_auth/mfa/totp.html.eex index 27600253c..50e6c04b6 100644 --- a/lib/pleroma/web/templates/o_auth/mfa/totp.html.eex +++ b/lib/pleroma/web/templates/o_auth/mfa/totp.html.eex @@ -5,11 +5,11 @@ <% end %> -

Two-factor authentication

+

<%= Gettext.dpgettext("static_pages", "mfa auth page title", "Two-factor authentication") %>

<%= form_for @conn, Routes.mfa_verify_path(@conn, :verify), [as: "mfa"], fn f -> %>
- <%= label f, :code, "Authentication code" %> + <%= label f, :code, Gettext.dpgettext("static_pages", "mfa auth code prompt", "Authentication code") %> <%= text_input f, :code, [autocomplete: "one-time-code", autocorrect: "off", autocapitalize: "off", autofocus: true, pattern: "[0-9]*", spellcheck: false] %> <%= hidden_input f, :mfa_token, value: @mfa_token %> <%= hidden_input f, :state, value: @state %> @@ -17,8 +17,8 @@ <%= hidden_input f, :challenge_type, value: "totp" %>
-<%= submit "Verify" %> +<%= submit Gettext.dpgettext("static_pages", "mfa auth verify code button", "Verify") %> <% end %> "> - Enter a two-factor recovery code + <%= Gettext.dpgettext("static_pages", "mfa auth page use recovery code link", "Enter a two-factor recovery code") %> diff --git a/priv/gettext/static_pages.pot b/priv/gettext/static_pages.pot index f9d535838..1af6796c8 100644 --- a/priv/gettext/static_pages.pot +++ b/priv/gettext/static_pages.pot @@ -305,3 +305,51 @@ msgstr "" msgctxt "oauth token code message" msgid "Token code is
%{token}" msgstr "" + +#, elixir-format +#: lib/pleroma/web/templates/o_auth/mfa/totp.html.eex:12 +msgctxt "mfa auth code prompt" +msgid "Authentication code" +msgstr "" + +#, elixir-format +#: lib/pleroma/web/templates/o_auth/mfa/totp.html.eex:8 +msgctxt "mfa auth page title" +msgid "Two-factor authentication" +msgstr "" + +#, elixir-format +#: lib/pleroma/web/templates/o_auth/mfa/totp.html.eex:23 +msgctxt "mfa auth page use recovery code link" +msgid "Enter a two-factor recovery code" +msgstr "" + +#, elixir-format +#: lib/pleroma/web/templates/o_auth/mfa/totp.html.eex:20 +msgctxt "mfa auth verify code button" +msgid "Verify" +msgstr "" + +#, elixir-format +#: lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex:8 +msgctxt "mfa recover page title" +msgid "Two-factor recovery" +msgstr "" + +#, elixir-format +#: lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex:12 +msgctxt "mfa recover recovery code prompt" +msgid "Recovery code" +msgstr "" + +#, elixir-format +#: lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex:23 +msgctxt "mfa recover use 2fa code link" +msgid "Enter a two-factor code" +msgstr "" + +#, elixir-format +#: lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex:20 +msgctxt "mfa recover verify recovery code button" +msgid "Verify" +msgstr ""