From dfa2fd7d3d969cb196692dc3e7692153ae6ea5b8 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 25 Apr 2018 14:56:20 +0800 Subject: [PATCH] Rename note to notes in i18n lookups Enables lazy translation lookups for most cases. Additionally, rename keys for notes.description.* to notes.comment.* to match partial name. --- app/views/notes/_comment.html.erb | 4 ++-- app/views/notes/_entry.html.erb | 4 ++-- app/views/notes/_note.rss.builder | 6 +++--- app/views/notes/feed.rss.builder | 6 +++--- app/views/notes/index.rss.builder | 4 ++-- app/views/notes/mine.html.erb | 16 ++++++++-------- app/views/notes/show.rss.builder | 4 ++-- config/locales/en.yml | 4 ++-- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/app/views/notes/_comment.html.erb b/app/views/notes/_comment.html.erb index c0d6e17d3..d9c17848b 100644 --- a/app/views/notes/_comment.html.erb +++ b/app/views/notes/_comment.html.erb @@ -1,8 +1,8 @@
<% if comment.author.nil? -%> -
<%= t "note.description.#{comment.event}_at_html", :when => friendly_date(comment.created_at) %>
+
<%= t ".#{comment.event}_at_html", :when => friendly_date(comment.created_at) %>
<% else -%> -
<%= t "note.description.#{comment.event}_at_by_html", :when => friendly_date(comment.created_at), :user => note_author(comment.author, :only_path => false) %>
+
<%= t ".#{comment.event}_at_by_html", :when => friendly_date(comment.created_at), :user => note_author(comment.author, :only_path => false) %>
<% end -%>
<%= comment.body %>
diff --git a/app/views/notes/_entry.html.erb b/app/views/notes/_entry.html.erb index 6f0c8fb71..624ecd15d 100644 --- a/app/views/notes/_entry.html.erb +++ b/app/views/notes/_entry.html.erb @@ -1,4 +1,4 @@ -

<%= t "note.entry.comment" %>

+

<%= t ".comment" %>

<%= render :partial => "comment", :object => entry %> -

<%= t "note.entry.full" %>

+

<%= t ".full" %>

<%= render :partial => "description", :object => entry.note %> diff --git a/app/views/notes/_note.rss.builder b/app/views/notes/_note.rss.builder index 38c42f1ec..9c72b8a5d 100644 --- a/app/views/notes/_note.rss.builder +++ b/app/views/notes/_note.rss.builder @@ -2,11 +2,11 @@ xml.item do location = describe_location(note.lat, note.lon, 14, locale) if note.closed? - xml.title t("note.rss.closed", :place => location) + xml.title t("notes.rss.closed", :place => location) elsif note.comments.length > 1 - xml.title t("note.rss.commented", :place => location) + xml.title t("notes.rss.commented", :place => location) else - xml.title t("note.rss.opened", :place => location) + xml.title t("notes.rss.opened", :place => location) end xml.link browse_note_url(note) diff --git a/app/views/notes/feed.rss.builder b/app/views/notes/feed.rss.builder index 708192e5f..4a4fb3e1a 100644 --- a/app/views/notes/feed.rss.builder +++ b/app/views/notes/feed.rss.builder @@ -5,15 +5,15 @@ xml.rss("version" => "2.0", "xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#", "xmlns:georss" => "http://www.georss.org/georss") do xml.channel do - xml.title t("note.rss.title") - xml.description t("note.rss.description_area", :min_lat => @min_lat, :min_lon => @min_lon, :max_lat => @max_lat, :max_lon => @max_lon) + xml.title t("notes.rss.title") + xml.description t("notes.rss.description_area", :min_lat => @min_lat, :min_lon => @min_lon, :max_lat => @max_lat, :max_lon => @max_lon) xml.link url_for(:controller => "site", :action => "index", :only_path => false) @comments.each do |comment| location = describe_location(comment.note.lat, comment.note.lon, 14, locale) xml.item do - xml.title t("note.rss.#{comment.event}", :place => location) + xml.title t("notes.rss.#{comment.event}", :place => location) xml.link url_for(:controller => "browse", :action => "note", :id => comment.note.id, :anchor => "c#{comment.id}", :only_path => false) xml.guid url_for(:controller => "browse", :action => "note", :id => comment.note.id, :anchor => "c#{comment.id}", :only_path => false) diff --git a/app/views/notes/index.rss.builder b/app/views/notes/index.rss.builder index e912b9921..d28efa194 100644 --- a/app/views/notes/index.rss.builder +++ b/app/views/notes/index.rss.builder @@ -5,8 +5,8 @@ xml.rss("version" => "2.0", "xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#", "xmlns:georss" => "http://www.georss.org/georss") do xml.channel do - xml.title t("note.rss.title") - xml.description t("note.rss.description_area", :min_lat => @min_lat, :min_lon => @min_lon, :max_lat => @max_lat, :max_lon => @max_lon) + xml.title t("notes.rss.title") + xml.description t("notes.rss.description_area", :min_lat => @min_lat, :min_lon => @min_lon, :max_lat => @max_lat, :max_lon => @max_lon) xml.link url_for(:controller => "site", :action => "index", :only_path => false) xml << (render(:partial => "note", :collection => @notes) || "") diff --git a/app/views/notes/mine.html.erb b/app/views/notes/mine.html.erb index 666c7dc8f..13824419e 100644 --- a/app/views/notes/mine.html.erb +++ b/app/views/notes/mine.html.erb @@ -8,11 +8,11 @@ - - - - - + + + + + <% @notes.each do |note| -%> class="creator"<% end %>> @@ -25,9 +25,9 @@ - - - + + + <% end -%>
<%= t'note.mine.id' %><%= t'note.mine.creator' %><%= t'note.mine.description' %><%= t'note.mine.created_at' %><%= t'note.mine.last_changed' %><%= t '.id' %><%= t '.creator' %><%= t '.description' %><%= t '.created_at' %><%= t '.last_changed' %>
<%= link_to note.id.to_s, :controller => "browse", :action => "note", :id => note.id %> <%= note_author(note.author) %><%= note.comments.first.body.to_html %><%= t 'note.mine.ago_html', :when => friendly_date(note.created_at) %><%= t 'note.mine.ago_html', :when => friendly_date(note.updated_at) %><%= note.comments.first.body.to_html %><%= t '.ago_html', :when => friendly_date(note.created_at) %><%= t '.ago_html', :when => friendly_date(note.updated_at) %>
diff --git a/app/views/notes/show.rss.builder b/app/views/notes/show.rss.builder index 62ccbe8a9..f40647900 100644 --- a/app/views/notes/show.rss.builder +++ b/app/views/notes/show.rss.builder @@ -4,8 +4,8 @@ xml.rss("version" => "2.0", "xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#", "xmlns:georss" => "http://www.georss.org/georss") do xml.channel do - xml.title t("note.rss.title") - xml.description t("note.rss.description_item", :id => @note.id) + xml.title t("notes.rss.title") + xml.description t("notes.rss.description_item", :id => @note.id) xml.link url_for(:controller => "site", :action => "index", :only_path => false) xml << render(:partial => "note", :object => @note) diff --git a/config/locales/en.yml b/config/locales/en.yml index b31ce4d5d..e3c773810 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2203,8 +2203,8 @@ en: showing_page: "Page %{page}" next: "Next »" previous: "« Previous" - note: - description: + notes: + comment: opened_at_html: "Created %{when} ago" opened_at_by_html: "Created %{when} ago by %{user}" commented_at_html: "Updated %{when} ago" -- 2.39.5