Make oauth pages translatable
authorTusooa Zhu <tusooa@kazv.moe>
Mon, 28 Feb 2022 07:11:57 +0000 (02:11 -0500)
committerFloatingGhost <hannah@coffee-and-dreams.uk>
Wed, 29 Jun 2022 19:44:48 +0000 (20:44 +0100)
lib/pleroma/web/o_auth/o_auth_view.ex
lib/pleroma/web/templates/o_auth/o_auth/_scopes.html.eex
lib/pleroma/web/templates/o_auth/o_auth/consumer.html.eex
lib/pleroma/web/templates/o_auth/o_auth/oob_authorization_created.html.eex
lib/pleroma/web/templates/o_auth/o_auth/oob_token_exists.html.eex
lib/pleroma/web/templates/o_auth/o_auth/register.html.eex
lib/pleroma/web/templates/o_auth/o_auth/show.html.eex
priv/gettext/static_pages.pot

index 1419c96a2f905bbecffeb70702b5bc0bf711ed08..57a315705f7fb9a1485485c16eba88dea2513600 100644 (file)
@@ -5,6 +5,8 @@
 defmodule Pleroma.Web.OAuth.OAuthView do
   use Pleroma.Web, :view
   import Phoenix.HTML.Form
+  import Phoenix.HTML
+  alias Pleroma.Web.Gettext
 
   alias Pleroma.Web.OAuth.Token.Utils
 
index c9ec1ecbfae18749f0c808e31d9b9e155a38c62e..73115e92a2f191a1646f2d2e2e3c3b990d985260 100644 (file)
@@ -1,5 +1,5 @@
 <div class="scopes-input">
-  <%= label @form, :scope, "The following permissions will be granted" %>
+  <%= label @form, :scope, Gettext.dpgettext("static_pages", "oauth scopes message", "The following permissions will be granted") %>
   <div class="scopes">
     <%= for scope <- @available_scopes do %>
       <%# Note: using hidden input with `unchecked_value` in order to distinguish user's empty selection from `scope` param being omitted %>
index dc4521a62b41b7ee358e7c1908eafe09216d24fd..8b894cd58a3053413355b6972145a40b574fef5f 100644 (file)
@@ -1,4 +1,4 @@
-<h2>Sign in with external provider</h2>
+<h2><%= Gettext.dpgettext("static_pages", "oauth external provider page title", "Sign in with external provider") %></h2>
 
 <%= form_for @conn, Routes.o_auth_path(@conn, :prepare_request), [as: "authorization", method: "get"], fn f -> %>
   <div style="display: none">
@@ -10,6 +10,6 @@
   <%= hidden_input f, :state, value: @state %>
 
     <%= for strategy <- Pleroma.Config.oauth_consumer_strategies() do %>
-      <%= submit "Sign in with #{String.capitalize(strategy)}", name: "provider", value: strategy %>
+      <%= submit Gettext.dpgettext("static_pages", "oauth external provider sign in button", "Sign in with %{strategy}", strategy: String.capitalize(strategy)), name: "provider", value: strategy %>
     <% end %>
 <% end %>
index ffabe29a624ad85c67cd5e5ab5553bc9dde80cce..aaa38513adcea6851c8d61771ec89b652ebd7390 100644 (file)
@@ -1,2 +1,2 @@
-<h1>Successfully authorized</h1>
-<h2>Token code is <br><%= @auth.token %></h2>
+<h1><%= Gettext.dpgettext("static_pages", "oauth authorized page title", "Successfully authorized") %></h1>
+<h2><%= raw Gettext.dpgettext("static_pages", "oauth token code message", "Token code is <br>%{token}", token: html_escape(@auth.token)) %></h2>
index 82785c4b99bede3011b23c3e8a44d4b64751bd2a..de4cd0f3435939df3239134261106d3b58407b58 100644 (file)
@@ -1,2 +1,2 @@
-<h1>Authorization exists</h1>
-<h2>Access token is <br><%= @token.token %></h2>
+<h1><%= Gettext.dpgettext("static_pages", "oauth authorization exists page title", "Authorization exists") %></h1>
+<h2><%= raw Gettext.dpgettext("static_pages", "oauth token code message", "Token code is <br>%{token}", token: html_escape(@auth.token)) %></h2>
index 99f900fb7ccf59a9a64f1c9c22f78c11bd822605..1f661efb212a4dff5512ec4db979dcf77dffef1c 100644 (file)
@@ -5,34 +5,34 @@
   <p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
 <% end %>
 
-<h2>Registration Details</h2>
+<h2><%= Gettext.dpgettext("static_pages", "oauth register page title", "Registration Details") %></h2>
 
-<p>If you'd like to register a new account, please provide the details below.</p>
+<p><%= Gettext.dpgettext("static_pages", "oauth register page fill form prompt", "If you'd like to register a new account, please provide the details below.") %></p>
 <%= form_for @conn, Routes.o_auth_path(@conn, :register), [as: "authorization"], fn f -> %>
 
 <div class="input">
-  <%= label f, :nickname, "Nickname" %>
-  <%= text_input f, :nickname, value: @nickname %>
+  <%= label f, :nickname, Gettext.dpgettext("static_pages", "oauth register page nickname prompt", "Nickname") %>
+  <%= text_input f, :nickname, value: @nickname, autocomplete: "username" %>
 </div>
 <div class="input">
-  <%= label f, :email, "Email" %>
-  <%= text_input f, :email, value: @email %>
+  <%= label f, :email, Gettext.dpgettext("static_pages", "oauth register page email prompt", "Email") %>
+  <%= text_input f, :email, value: @email, autocomplete: "email" %>
 </div>
 
-<%= submit "Proceed as new user", name: "op", value: "register" %>
+<%= submit Gettext.dpgettext("static_pages", "oauth register page register button", "Proceed as new user"), name: "op", value: "register" %>
 
-<p>Alternatively, sign in to connect to existing account.</p>
+<p><%= Gettext.dpgettext("static_pages", "oauth register page login prompt", "Alternatively, sign in to connect to existing account.") %></p>
 
 <div class="input">
-  <%= label f, :name, "Name or email" %>
-  <%= text_input f, :name %>
+  <%= label f, :name, Gettext.dpgettext("static_pages", "oauth register page login username prompt", "Name or email") %>
+  <%= text_input f, :name, autocomplete: "username" %>
 </div>
 <div class="input">
-  <%= label f, :password, "Password" %>
-  <%= password_input f, :password %>
+  <%= label f, :password, Gettext.dpgettext("static_pages", "oauth register page login password prompt", "Password") %>
+  <%= password_input f, :password, autocomplete: "password" %>
 </div>
 
-<%= submit "Proceed as existing user", name: "op", value: "connect" %>
+<%= submit Gettext.dpgettext("static_pages", "oauth register page login button", "Proceed as existing user"), name: "op", value: "connect" %>
 
 <%= hidden_input f, :client_id, value: @client_id %>
 <%= hidden_input f, :redirect_uri, value: @redirect_uri %>
index 181a9519ab843ea6b168efd7dc6f3e7a79603711..31ae3cd1ba85f4723968ed70372413c9a01e2e91 100644 (file)
 
 <div class="container__content">
   <%= if @app do %>
-    <p>Application <strong><%= @app.client_name %></strong> is requesting access to your account.</p>
+    <p><%= raw Gettext.dpgettext("static_pages", "oauth authorize message", "Application <strong>%{client_name}</strong> is requesting access to your account.", client_name: html_escape(@app.client_name)) %></p>
     <%= render @view_module, "_scopes.html", Map.merge(assigns, %{form: f}) %>
   <% end %>
 
   <%= if @user do %>
     <div class="actions">
-      <a class="button button--cancel" href="/">Cancel</a>
-      <%= submit "Approve", class: "button--approve" %>
+      <a class="button button--cancel" href="/">
+        <%= Gettext.dpgettext("static_pages", "oauth authorize cancel button", "Cancel") %>
+      </a>
+      <%= submit Gettext.dpgettext("static_pages", "oauth authorize approve button", "Approve"), class: "button--approve" %>
     </div>
   <% else %>
     <%= if @params["registration"] in ["true", true] do %>
-      <h3>This is the first time you visit! Please enter your Pleroma handle.</h3>
-      <p>Choose carefully! You won't be able to change this later. You will be able to change your display name, though.</p>
+      <h3><%= Gettext.dpgettext("static_pages", "oauth register page title", "This is the first time you visit! Please enter your Pleroma handle.") %></h3>
+      <p><%= Gettext.dpgettext("static_pages", "oauth register nickname unchangeable warning", "Choose carefully! You won't be able to change this later. You will be able to change your display name, though.") %></p>
       <div class="input">
-        <%= label f, :nickname, "Pleroma Handle" %>
-        <%= text_input f, :nickname, placeholder: "lain" %>
+        <%= label f, :nickname, Gettext.dpgettext("static_pages", "oauth register nickname prompt", "Pleroma Handle") %>
+        <%= text_input f, :nickname, placeholder: "lain", autocomplete: "username" %>
       </div>
       <%= hidden_input f, :name, value: @params["name"] %>
       <%= hidden_input f, :password, value: @params["password"] %>
       <br>
     <% else %>
       <div class="input">
-        <%= label f, :name, "Username" %>
+        <%= label f, :name, Gettext.dpgettext("static_pages", "oauth login username prompt", "Username") %>
         <%= text_input f, :name %>
       </div>
       <div class="input">
-        <%= label f, :password, "Password" %>
+        <%= label f, :password, Gettext.dpgettext("static_pages", "oauth login password prompt", "Password") %>
         <%= password_input f, :password %>
       </div>
-      <%= submit "Log In" %>
+      <%= submit Gettext.dpgettext("static_pages", "oauth login button", "Log In") %>
     <% end %>
   <% end %>
 </div>
index b230fbaa7ac77a7ee3098aec0961152414d955af..f9d535838d4595977a1d59f84a7b916d0c825a5d 100644 (file)
@@ -160,3 +160,148 @@ msgstr ""
 msgctxt "tag feed description"
 msgid "These are public toots tagged with #%{tag}. You can interact with them if you have an account anywhere in the fediverse."
 msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/oob_token_exists.html.eex:1
+msgctxt "oauth authorization exists page title"
+msgid "Authorization exists"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/show.html.eex:32
+msgctxt "oauth authorize approve button"
+msgid "Approve"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/show.html.eex:30
+msgctxt "oauth authorize cancel button"
+msgid "Cancel"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/show.html.eex:23
+msgctxt "oauth authorize message"
+msgid "Application <strong>%{client_name}</strong> is requesting access to your account."
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/oob_authorization_created.html.eex:1
+msgctxt "oauth authorized page title"
+msgid "Successfully authorized"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/consumer.html.eex:1
+msgctxt "oauth external provider page title"
+msgid "Sign in with external provider"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/consumer.html.eex:13
+msgctxt "oauth external provider sign in button"
+msgid "Sign in with %{strategy}"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/show.html.eex:54
+msgctxt "oauth login button"
+msgid "Log In"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/show.html.eex:51
+msgctxt "oauth login password prompt"
+msgid "Password"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/show.html.eex:47
+msgctxt "oauth login username prompt"
+msgid "Username"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/show.html.eex:39
+msgctxt "oauth register nickname prompt"
+msgid "Pleroma Handle"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/show.html.eex:37
+msgctxt "oauth register nickname unchangeable warning"
+msgid "Choose carefully! You won't be able to change this later. You will be able to change your display name, though."
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/register.html.eex:18
+msgctxt "oauth register page email prompt"
+msgid "Email"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/register.html.eex:10
+msgctxt "oauth register page fill form prompt"
+msgid "If you'd like to register a new account, please provide the details below."
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/register.html.eex:35
+msgctxt "oauth register page login button"
+msgid "Proceed as existing user"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/register.html.eex:31
+msgctxt "oauth register page login password prompt"
+msgid "Password"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/register.html.eex:24
+msgctxt "oauth register page login prompt"
+msgid "Alternatively, sign in to connect to existing account."
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/register.html.eex:27
+msgctxt "oauth register page login username prompt"
+msgid "Name or email"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/register.html.eex:14
+msgctxt "oauth register page nickname prompt"
+msgid "Nickname"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/register.html.eex:22
+msgctxt "oauth register page register button"
+msgid "Proceed as new user"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/register.html.eex:8
+msgctxt "oauth register page title"
+msgid "Registration Details"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/show.html.eex:36
+msgctxt "oauth register page title"
+msgid "This is the first time you visit! Please enter your Pleroma handle."
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/_scopes.html.eex:2
+msgctxt "oauth scopes message"
+msgid "The following permissions will be granted"
+msgstr ""
+
+#, elixir-format
+#: lib/pleroma/web/templates/o_auth/o_auth/oob_authorization_created.html.eex:2
+#: lib/pleroma/web/templates/o_auth/o_auth/oob_token_exists.html.eex:2
+msgctxt "oauth token code message"
+msgid "Token code is <br>%{token}"
+msgstr ""