Make remote follow pages translatable

This commit is contained in:
Tusooa Zhu 2022-02-21 18:42:25 -05:00
parent 0fd3695b9c
commit a867107437
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
7 changed files with 18 additions and 17 deletions

View file

@ -1,11 +1,11 @@
<%= if @error == :error do %> <%= if @error == :error do %>
<h2>Error fetching user</h2> <h2><%= Gettext.dpgettext("static_pages", "remote follow error", "Error fetching user") %></h2>
<% else %> <% else %>
<h2>Remote follow</h2> <h2><%= Gettext.dpgettext("static_pages", "remote follow header", "Remote follow") %></h2>
<img height="128" width="128" src="<%= avatar_url(@followee) %>"> <img height="128" width="128" src="<%= avatar_url(@followee) %>">
<p><%= @followee.nickname %></p> <p><%= @followee.nickname %></p>
<%= form_for @conn, Routes.remote_follow_path(@conn, :do_follow), [as: "user"], fn f -> %> <%= form_for @conn, Routes.remote_follow_path(@conn, :do_follow), [as: "user"], fn f -> %>
<%= hidden_input f, :id, value: @followee.id %> <%= hidden_input f, :id, value: @followee.id %>
<%= submit "Authorize" %> <%= submit Gettext.dpgettext("static_pages", "remote follow authorization button", "Authorize") %>
<% end %> <% end %>
<% end %> <% end %>

View file

@ -1,14 +1,14 @@
<%= if @error do %> <%= if @error do %>
<h2><%= @error %></h2> <h2><%= @error %></h2>
<% end %> <% end %>
<h2>Log in to follow</h2> <h2><%= Gettext.dpgettext("static_pages", "remote follow header, need login", "Log in to follow") %></h2>
<p><%= @followee.nickname %></p> <p><%= @followee.nickname %></p>
<img height="128" width="128" src="<%= avatar_url(@followee) %>"> <img height="128" width="128" src="<%= avatar_url(@followee) %>">
<%= form_for @conn, Routes.remote_follow_path(@conn, :do_follow), [as: "authorization"], fn f -> %> <%= form_for @conn, Routes.remote_follow_path(@conn, :do_follow), [as: "authorization"], fn f -> %>
<%= text_input f, :name, placeholder: "Username", required: true, autocomplete: "username" %> <%= text_input f, :name, placeholder: Gettext.dpgettext("static_pages", "placeholder text for username entry", "Username"), required: true, autocomplete: "username" %>
<br> <br>
<%= password_input f, :password, placeholder: "Password", required: true, autocomplete: "password" %> <%= password_input f, :password, placeholder: Gettext.dpgettext("static_pages", "placeholder text for password entry", "Password"), required: true, autocomplete: "password" %>
<br> <br>
<%= hidden_input f, :id, value: @followee.id %> <%= hidden_input f, :id, value: @followee.id %>
<%= submit "Authorize" %> <%= submit Gettext.dpgettext("static_pages", "remote follow authorization button for login", "Authorize") %>
<% end %> <% end %>

View file

@ -1,13 +1,13 @@
<%= if @error do %> <%= if @error do %>
<h2><%= @error %></h2> <h2><%= @error %></h2>
<% end %> <% end %>
<h2>Two-factor authentication</h2> <h2><%= Gettext.dpgettext("static_pages", "remote follow mfa header", "Two-factor authentication") %></h2>
<p><%= @followee.nickname %></p> <p><%= @followee.nickname %></p>
<img height="128" width="128" src="<%= avatar_url(@followee) %>"> <img height="128" width="128" src="<%= avatar_url(@followee) %>">
<%= form_for @conn, Routes.remote_follow_path(@conn, :do_follow), [as: "mfa"], fn f -> %> <%= form_for @conn, Routes.remote_follow_path(@conn, :do_follow), [as: "mfa"], fn f -> %>
<%= text_input f, :code, placeholder: "Authentication code", required: true %> <%= text_input f, :code, placeholder: Gettext.dpgettext("static_pages", "placeholder text for auth code entry", "Authentication code"), required: true %>
<br> <br>
<%= hidden_input f, :id, value: @followee.id %> <%= hidden_input f, :id, value: @followee.id %>
<%= hidden_input f, :token, value: @mfa_token %> <%= hidden_input f, :token, value: @mfa_token %>
<%= submit "Authorize" %> <%= submit Gettext.dpgettext("static_pages", "remote follow authorization button for mfa", "Authorize") %>
<% end %> <% end %>

View file

@ -1,6 +1,5 @@
<%= if @error do %> <%= if @error do %>
<p>Error following account</p> <p><%= Gettext.dpgettext("static_pages", "remote follow error", "Error following account") %></p>
<% else %> <% else %>
<h2>Account followed!</h2> <h2><%= Gettext.dpgettext("static_pages", "remote follow success", "Account followed!") %></h2>
<% end %> <% end %>

View file

@ -1,10 +1,10 @@
<%= if @error do %> <%= if @error do %>
<h2>Error: <%= @error %></h2> <h2><%= Gettext.dpgettext("static_pages", "remote follow error", "Error: %{error}", error: @error) %></h2>
<% else %> <% else %>
<h2>Remotely follow <%= @nickname %></h2> <h2><%= Gettext.dpgettext("static_pages", "remote follow header", "Remotely follow %{nickname}", nickname: @nickname) %></h2>
<%= form_for @conn, Routes.util_path(@conn, :remote_subscribe), [as: "user"], fn f -> %> <%= form_for @conn, Routes.util_path(@conn, :remote_subscribe), [as: "user"], fn f -> %>
<%= hidden_input f, :nickname, value: @nickname %> <%= hidden_input f, :nickname, value: @nickname %>
<%= text_input f, :profile, placeholder: "Your account ID, e.g. lain@quitter.se" %> <%= text_input f, :profile, placeholder: Gettext.dpgettext("static_pages", "placeholder text for account id", "Your account ID, e.g. lain@quitter.se") %>
<%= submit "Follow" %> <%= submit Gettext.dpgettext("static_pages", "remote follow authorization button for following with a remote account", "Follow") %>
<% end %> <% end %>
<% end %> <% end %>

View file

@ -5,6 +5,7 @@
defmodule Pleroma.Web.TwitterAPI.RemoteFollowView do defmodule Pleroma.Web.TwitterAPI.RemoteFollowView do
use Pleroma.Web, :view use Pleroma.Web, :view
import Phoenix.HTML.Form import Phoenix.HTML.Form
alias Pleroma.Web.Gettext
defdelegate avatar_url(user), to: Pleroma.User defdelegate avatar_url(user), to: Pleroma.User
end end

View file

@ -7,6 +7,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilView do
import Phoenix.HTML.Form import Phoenix.HTML.Form
alias Pleroma.Config alias Pleroma.Config
alias Pleroma.Web.Endpoint alias Pleroma.Web.Endpoint
alias Pleroma.Web.Gettext
def status_net_config(instance) do def status_net_config(instance) do
""" """