]> git.openstreetmap.org Git - rails.git/commitdiff
Use lazy translation lookups for redactions
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 25 Apr 2018 06:39:37 +0000 (14:39 +0800)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 25 Apr 2018 06:39:37 +0000 (14:39 +0800)
Requires renaming the translation keys

app/controllers/redactions_controller.rb
app/views/redactions/edit.html.erb
app/views/redactions/index.html.erb
app/views/redactions/new.html.erb
app/views/redactions/show.html.erb
config/locales/en.yml

index f15060d5b596d2ca62be7fc0c0334e7a25e706a3..b8ecce9e250fca521d3ae346f8b958a30026973e 100644 (file)
@@ -25,7 +25,7 @@ class RedactionsController < ApplicationController
     # note that the description format will default to 'markdown'
 
     if @redaction.save
     # note that the description format will default to 'markdown'
 
     if @redaction.save
-      flash[:notice] = t("redaction.create.flash")
+      flash[:notice] = t(".flash")
       redirect_to @redaction
     else
       render :action => "new"
       redirect_to @redaction
     else
       render :action => "new"
@@ -42,7 +42,7 @@ class RedactionsController < ApplicationController
     @redaction.description = params[:redaction][:description]
 
     if @redaction.save
     @redaction.description = params[:redaction][:description]
 
     if @redaction.save
-      flash[:notice] = t("redaction.update.flash")
+      flash[:notice] = t(".flash")
       redirect_to @redaction
     else
       render :action => "edit"
       redirect_to @redaction
     else
       render :action => "edit"
@@ -54,14 +54,14 @@ class RedactionsController < ApplicationController
        @redaction.old_ways.empty? &&
        @redaction.old_relations.empty?
       if @redaction.destroy
        @redaction.old_ways.empty? &&
        @redaction.old_relations.empty?
       if @redaction.destroy
-        flash[:notice] = t("redaction.destroy.flash")
+        flash[:notice] = t(".flash")
         redirect_to :redactions
       else
         redirect_to :redactions
       else
-        flash[:error] = t("redaction.destroy.error")
+        flash[:error] = t(".error")
         redirect_to @redaction
       end
     else
         redirect_to @redaction
       end
     else
-      flash[:error] = t("redaction.destroy.not_empty")
+      flash[:error] = t(".not_empty")
       redirect_to @redaction
     end
   end
       redirect_to @redaction
     end
   end
index 2dd63c9cbda9a85d49c2fab3d47f6b0d517effee..fe85d0756246f8df0c6e1f18fb7fd9aa335592ba 100644 (file)
@@ -1,22 +1,21 @@
-<% @title = t 'redaction.edit.title' %>
+<% @title = t '.title' %>
 
 <% content_for :heading do %>
 
 <% content_for :heading do %>
-  <h1><%= t 'redaction.edit.heading' %></h1>
+  <h1><%= t '.heading' %></h1>
 <% end %>
 
 <%= form_for(@redaction) do |f| %>
   <%= f.error_messages %>
 
   <p>
 <% end %>
 
 <%= form_for(@redaction) do |f| %>
   <%= f.error_messages %>
 
   <p>
-    <%= f.label :title, t('redaction.edit.title') %><br />
+    <%= f.label :title, t('.title') %><br />
     <%= f.text_field :title %>
   </p>
   <p>
     <%= f.text_field :title %>
   </p>
   <p>
-    <%= f.label :description, t('redaction.edit.description') %><br />
+    <%= f.label :description, t('.description') %><br />
     <%= richtext_area :redaction, :description, :cols => 80, :rows => 20, :format => @redaction.description_format %>
   </p>
   <p>
     <%= richtext_area :redaction, :description, :cols => 80, :rows => 20, :format => @redaction.description_format %>
   </p>
   <p>
-    <%= f.submit t('redaction.edit.submit') %>
+    <%= f.submit t('.submit') %>
   </p>
 <% end %>
   </p>
 <% end %>
-
index a5a85c38d4758093c5d12a7b04e6394c6ac780e9..b53e9b74780496119932f321eb31e4884bd6f340 100644 (file)
@@ -1,10 +1,10 @@
-<% @title = t('redaction.index.title') %>
+<% @title = t('.title') %>
 <% content_for :heading do %>
 <% content_for :heading do %>
-  <h1><%= t('redaction.index.heading') %></h1>
+  <h1><%= t('.heading') %></h1>
 <% end %>
 
 <% unless @redactions.empty? %>
   <%= render :partial => 'redactions' %>
 <% else %>
 <% end %>
 
 <% unless @redactions.empty? %>
   <%= render :partial => 'redactions' %>
 <% else %>
-  <p><%= t 'redaction.index.empty' %></p>
+  <p><%= t '.empty' %></p>
 <% end %>
 <% end %>
index 5004c0e1e8178a6247fe37f8ae6f83995ebbf5e1..e6838073d1065172ed55a41f6b6d8eb3532ddbb8 100644 (file)
@@ -1,22 +1,20 @@
-<% @title = t 'redaction.new.title' %>
+<% @title = t '.title' %>
 <% content_for :heading do %>
 <% content_for :heading do %>
-  <h1><%= t 'redaction.new.heading' %></h1>
+  <h1><%= t '.heading' %></h1>
 <% end %>
 
 <%= form_for(@redaction) do |f| %>
   <%= f.error_messages %>
 
   <p>
 <% end %>
 
 <%= form_for(@redaction) do |f| %>
   <%= f.error_messages %>
 
   <p>
-    <%= f.label :title, t('redaction.new.title') %><br />
+    <%= f.label :title, t('.title') %><br />
     <%= f.text_field :title %>
   </p>
   <p>
     <%= f.text_field :title %>
   </p>
   <p>
-    <%= f.label :description, t('redaction.new.description') %><br />
+    <%= f.label :description, t('.description') %><br />
     <%= richtext_area :redaction, :description, :cols => 80, :rows => 20, :format => @redaction.description_format %>
   </p>
   <p>
     <%= richtext_area :redaction, :description, :cols => 80, :rows => 20, :format => @redaction.description_format %>
   </p>
   <p>
-    <%= f.submit t('redaction.new.submit') %>
+    <%= f.submit t('.submit') %>
   </p>
 <% end %>
   </p>
 <% end %>
-
-
index 99f7cd1f1a42d834434f3ab37cfa72b8607d65ed..8ec72f3ac17cfd44a76ef8dc4ce88cf34efb8091 100644 (file)
@@ -1,20 +1,20 @@
-<% @title = t('redaction.show.title') %>
+<% @title = t('.title') %>
 <% content_for :heading do %>
 <% content_for :heading do %>
-  <h1><%= t('redaction.show.heading', :title => @redaction.title) %></h1>
+  <h1><%= t('.heading', :title => @redaction.title) %></h1>
 <% end %>
 
 <p>
 <% end %>
 
 <p>
-  <b><%= t 'redaction.show.user' %></b>
+  <b><%= t '.user' %></b>
   <%= link_to(@redaction.user.display_name, user_path(@redaction.user)) %>
 </p>
 <p class="richtext">
   <%= link_to(@redaction.user.display_name, user_path(@redaction.user)) %>
 </p>
 <p class="richtext">
-  <b><%= t 'redaction.show.description' %></b>
+  <b><%= t '.description' %></b>
   <%= @redaction.description.to_html %>
 </p>
 
 <% if current_user and current_user.moderator? %>
 <div class="buttons">
   <%= @redaction.description.to_html %>
 </p>
 
 <% if current_user and current_user.moderator? %>
 <div class="buttons">
-  <%= button_to t('redaction.show.edit'), edit_redaction_path(@redaction), :method => :get %></td>
-  <%= button_to t('redaction.show.destroy'), @redaction, :method => "delete", :remote => true, :data => { :confirm => t('redaction.show.confirm') } %>
+  <%= button_to t('.edit'), edit_redaction_path(@redaction), :method => :get %></td>
+  <%= button_to t('.destroy'), @redaction, :method => "delete", :remote => true, :data => { :confirm => t('.confirm') } %>
 </div>
 <% end %>
 </div>
 <% end %>
index b31ce4d5d6918fe1f05823039139095fa972e009..f5a13ef8521b327c7a3bf8e20b21a29ae514d34b 100644 (file)
@@ -2401,7 +2401,7 @@ en:
       show_address: Show address
       query_features: Query features
       centre_map: Centre map here
       show_address: Show address
       query_features: Query features
       centre_map: Centre map here
-  redaction:
+  redactions:
     edit:
       description: "Description"
       heading: "Edit redaction"
     edit:
       description: "Description"
       heading: "Edit redaction"