Make remote interaction page translatable

This commit is contained in:
Tusooa Zhu 2022-03-25 22:05:28 -04:00 committed by Francis Dinh
parent 9e52db493c
commit f9c39ef9e1
Signed by untrusted user: norm
GPG key ID: 7123E30E441E80DE
3 changed files with 29 additions and 8 deletions

View file

@ -1,10 +1,10 @@
<%= if @error do %> <%= if @error do %>
<h2>Error: <%= @error %></h2> <h2><%= Gettext.dpgettext("static_pages", "status interact error", "Error: %{error}", error: @error) %></h2>
<% else %> <% else %>
<h2>Interacting with <%= @nickname %>'s <%= link("status", to: @status_link) %></h2> <h2><%= raw Gettext.dpgettext("static_pages", "status interact header", "Interacting with %{nickname}'s %{status_link}", nickname: safe_to_string(html_escape(@nickname)), status_link: safe_to_string(link(Gettext.dpgettext("static_pages", "status interact header - status link text", "status"), to: @status_link))) %></h2>
<%= form_for @conn, Routes.util_path(@conn, :remote_subscribe), [as: "status"], fn f -> %> <%= form_for @conn, Routes.util_path(@conn, :remote_subscribe), [as: "status"], fn f -> %>
<%= hidden_input f, :status_id, value: @status_id %> <%= hidden_input f, :status_id, value: @status_id %>
<%= 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 "Interact" %> <%= submit Gettext.dpgettext("static_pages", "status interact authorization button", "Interact") %>
<% end %> <% end %>
<% end %> <% end %>

View file

@ -63,7 +63,12 @@ def show_subscribe_form(conn, %{"nickname" => nick}) do
render(conn, "subscribe.html", %{ render(conn, "subscribe.html", %{
nickname: nick, nickname: nick,
avatar: nil, avatar: nil,
error: "Could not find user" error:
Pleroma.Web.Gettext.dpgettext(
"static_pages",
"remote follow error message - user not found",
"Could not find user"
)
}) })
end end
end end
@ -86,7 +91,12 @@ def show_subscribe_form(conn, %{"status_id" => id}) do
render(conn, "status_interact.html", %{ render(conn, "status_interact.html", %{
status_id: id, status_id: id,
avatar: nil, avatar: nil,
error: "Could not find status" error:
Pleroma.Web.Gettext.dpgettext(
"static_pages",
"status interact error message - status not found",
"Could not find status"
)
}) })
end end
end end
@ -109,7 +119,12 @@ def remote_subscribe(conn, %{"user" => %{"nickname" => nick, "profile" => profil
render(conn, "subscribe.html", %{ render(conn, "subscribe.html", %{
nickname: nick, nickname: nick,
avatar: nil, avatar: nil,
error: "Something went wrong." error:
Pleroma.Web.Gettext.dpgettext(
"static_pages",
"remote follow error message - unknown error",
"Something went wrong."
)
}) })
end end
end end
@ -125,7 +140,12 @@ def remote_subscribe(conn, %{"status" => %{"status_id" => id, "profile" => profi
render(conn, "status_interact.html", %{ render(conn, "status_interact.html", %{
status_id: id, status_id: id,
avatar: nil, avatar: nil,
error: "Something went wrong." error:
Pleroma.Web.Gettext.dpgettext(
"static_pages",
"status interact error message - unknown error",
"Something went wrong."
)
}) })
end end
end end

View file

@ -4,6 +4,7 @@
defmodule Pleroma.Web.TwitterAPI.UtilView do defmodule Pleroma.Web.TwitterAPI.UtilView do
use Pleroma.Web, :view use Pleroma.Web, :view
import Phoenix.HTML
import Phoenix.HTML.Form import Phoenix.HTML.Form
import Phoenix.HTML.Link import Phoenix.HTML.Link
alias Pleroma.Config alias Pleroma.Config