Add support for internationalization
This commit is contained in:
parent
b6ede6ced1
commit
f5f44bdab9
7 changed files with 30 additions and 37 deletions
|
@ -33,21 +33,14 @@ def time_ago(date) do
|
|||
minutes = now.minute - date.minute
|
||||
seconds = now.second - date.second
|
||||
cond do
|
||||
years > 1 -> to_string(years) <> " years ago"
|
||||
years > 0 -> "1 year ago"
|
||||
months > 1 -> to_string(months) <> " months ago"
|
||||
months > 0 -> "1 month ago"
|
||||
days > 13 -> to_string(trunc(days / 7)) <> " weeks ago"
|
||||
days > 6 -> "1 week ago"
|
||||
days > 1 -> to_string(days) <> " days ago"
|
||||
days > 0 -> "1 day ago"
|
||||
hours > 1 -> to_string(hours) <> " hours ago"
|
||||
hours > 0 -> "1 hour ago"
|
||||
minutes > 1 -> to_string(minutes) <> " minutes ago"
|
||||
minutes > 0 -> "1 minute ago"
|
||||
seconds > 1 -> to_string(seconds) <> " seconds ago"
|
||||
seconds > 0 -> "1 second ago"
|
||||
true -> "now"
|
||||
years > 0 -> ngettext("1 year ago", "%{count} years ago", years)
|
||||
months > 0 -> ngettext("1 month ago", "%{count} months ago", months)
|
||||
days > 6 -> ngettext("1 week ago", "%{count} weeks ago", trunc(days / 7))
|
||||
days > 0 -> ngettext("1 day ago", "%{count} days ago", days)
|
||||
hours > 0 -> ngettext("1 hour ago", "%{count} hours ago", hours)
|
||||
minutes > 0 -> ngettext("1 minute ago", "%{count} minutes ago", minutes)
|
||||
seconds > 0 -> ngettext("1 second ago", "%{count} seconds ago", seconds)
|
||||
true -> gettext("now")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<div class="column sidebar">
|
||||
<div class="about panel">
|
||||
<div class="panel-heading">
|
||||
About <%= Pleroma.Config.get([:instance, :name]) %>
|
||||
<%= gettext("About %{instance}", instance: Pleroma.Config.get([:instance, :name])) %>
|
||||
</div>
|
||||
<div class="about-content">
|
||||
<%= raw render_html("/static/terms-of-service.html") %>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<a class="attachment" href="<%= @url %>">
|
||||
<%= if @nsfw do %>
|
||||
<div class="nsfw-banner" alt="<%= @name %>" title="<%= @name %>">
|
||||
<div>Hover to show content</div>
|
||||
<div><%= gettext("Hover to show content") %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= case @mediaType do %>
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
<svg class="fa-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<path d="M205 34.8c11.5 5.1 19 16.6 19 29.2v64H336c97.2 0 176 78.8 176 176c0 113.3-81.5 163.9-100.2 174.1c-2.5 1.4-5.3 1.9-8.1 1.9c-10.9 0-19.7-8.9-19.7-19.7c0-7.5 4.3-14.4 9.8-19.5c9.4-8.8 22.2-26.4 22.2-56.7c0-53-43-96-96-96H224v64c0 12.6-7.4 24.1-19 29.2s-25 3-34.4-5.4l-160-144C3.9 225.7 0 217.1 0 208s3.9-17.7 10.6-23.8l160-144c9.4-8.5 22.9-10.6 34.4-5.4z"/>
|
||||
</svg>
|
||||
Reply to
|
||||
<%= gettext("Reply to") %>
|
||||
</a>
|
||||
<span class="h-card">
|
||||
<a href="<%= (@reply_to_user.uri || @reply_to_user.ap_id) %>" class="u-url mention">
|
||||
|
@ -60,7 +60,7 @@
|
|||
<% end %>
|
||||
<%= if @edited_at do %>
|
||||
<div class="heading-edited-row">
|
||||
Edited <%= time_ago(@edited_at) %>
|
||||
<%= gettext("Edited %{timeago}", timeago: time_ago(@edited_at)) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -68,7 +68,7 @@
|
|||
<%= if @title != "" do %>
|
||||
<span class="status-summary"><%= raw @title %></span>
|
||||
<details <%= if open_content?() do %>open<% end %>>
|
||||
<summary>Show content</summary>
|
||||
<summary><%= gettext("Show content") %></summary>
|
||||
<% end %>
|
||||
<div class="status-body">
|
||||
<%= raw @content %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="panel conversation">
|
||||
<div class="panel-heading">
|
||||
Conversation
|
||||
<%= gettext("Conversation") %>
|
||||
</div>
|
||||
<%= for activity <- @activities do %>
|
||||
<%= render("_notice.html", activity) %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
Error
|
||||
<%= gettext("Error") %>
|
||||
</div>
|
||||
<div class="status-container">
|
||||
<%= @message %>
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
<div class="bottom-line">
|
||||
<%= link "@#{@user.nickname}", to: (@user.uri || @user.ap_id), class: "account-name" %>
|
||||
<%= if @user.is_admin && @user.show_role do %>
|
||||
<span class="user-role">Admin</span>
|
||||
<span class="user-role"><%= gettext("Admin") %></span>
|
||||
<% end %>
|
||||
<%= if @user.is_moderator && @user.show_role do %>
|
||||
<span class="user-role">Moderator</span>
|
||||
<span class="user-role"><%= gettext("Moderator") %></span>
|
||||
<% end %>
|
||||
<%= if @user.actor_type == "Service" do %>
|
||||
<span class="user-role">Bot</span>
|
||||
<span class="user-role"><%= gettext("Bot") %></span>
|
||||
<% end %>
|
||||
<%= if @user.is_locked do %>
|
||||
<span>
|
||||
|
@ -48,16 +48,16 @@
|
|||
</div>
|
||||
<div class="user-counts">
|
||||
<div class="user-count">
|
||||
<h5>Posts</h5>
|
||||
<h5><%= gettext("Posts") %></h5>
|
||||
<span><%= @user.note_count %></span>
|
||||
</div>
|
||||
<div class="user-count">
|
||||
<h5>Following</h5>
|
||||
<span><%= if @user.hide_follows_count do "Hidden" else @user.following_count end %></span>
|
||||
<h5><%= gettext("Following") %></h5>
|
||||
<span><%= if @user.hide_follows_count do gettext("Hidden") else @user.following_count end %></span>
|
||||
</div>
|
||||
<div class="user-count">
|
||||
<h5>Followers</h5>
|
||||
<span><%= if @user.hide_followers_count do "Hidden" else @user.follower_count end %></span>
|
||||
<h5><%= gettext("Followers") %></h5>
|
||||
<span><%= if @user.hide_followers_count do gettext("Hidden") else @user.follower_count end %></span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="user-bio"><%= raw @user.bio %></span>
|
||||
|
@ -73,36 +73,36 @@
|
|||
<div class="tab-switcher">
|
||||
<a href="<%= (@user.uri || @user.ap_id) %>">
|
||||
<button class="button-default tab <%= if @tab == "posts" do %>active<% end %>">
|
||||
Posts
|
||||
<%= gettext("Posts") %>
|
||||
</button>
|
||||
</a>
|
||||
<a href="<%= (@user.uri || @user.ap_id) %>/with_replies">
|
||||
<button class="button-default tab <%= if @tab == "with_replies" do %>active<% end %>">
|
||||
With Replies
|
||||
<%= gettext("With Replies") %>
|
||||
</button>
|
||||
</a>
|
||||
<%= unless @user.hide_follows do %>
|
||||
<a href="<%= (@user.uri || @user.ap_id) %>/following">
|
||||
<button class="button-default tab <%= if @tab == "following" do %>active<% end %>">
|
||||
Following
|
||||
<%= gettext("Following") %>
|
||||
</button>
|
||||
</a>
|
||||
<% end %>
|
||||
<%= unless @user.hide_followers do %>
|
||||
<a href="<%= (@user.uri || @user.ap_id) %>/followers">
|
||||
<button class="button-default tab <%= if @tab == "followers" do %>active<% end %>">
|
||||
Followers
|
||||
<%= gettext("Followers") %>
|
||||
</button>
|
||||
</a>
|
||||
<% end %>
|
||||
<a href="<%= (@user.uri || @user.ap_id) %>/media">
|
||||
<button class="button-default tab <%= if @tab == "media" do %>active<% end %>">
|
||||
Media
|
||||
<%= gettext("Media") %>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
<%= if @prev_page_id do %>
|
||||
<%= link "Show newer", to: "?min_id=" <> @prev_page_id, class: "load-posts" %>
|
||||
<%= link gettext("Show newer"), to: "?min_id=" <> @prev_page_id, class: "load-posts" %>
|
||||
<% end %>
|
||||
<div class="activity-stream">
|
||||
<%= if @tab in ["posts", "with_replies", "media"] do %>
|
||||
|
@ -116,7 +116,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<%= if @next_page_id do %>
|
||||
<%= link "Show older", to: "?max_id=" <> @next_page_id, class: "load-posts" %>
|
||||
<%= link gettext("Show older"), to: "?max_id=" <> @next_page_id, class: "load-posts" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue