From: Andy Allan Date: Wed, 25 Apr 2018 06:39:37 +0000 (+0800) Subject: Use lazy translation lookups for redactions X-Git-Tag: live~3655^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/2c7bc3649367bb7f1f75e8ed78c50464645b87cc Use lazy translation lookups for redactions Requires renaming the translation keys --- diff --git a/app/controllers/redactions_controller.rb b/app/controllers/redactions_controller.rb index f15060d5b..b8ecce9e2 100644 --- a/app/controllers/redactions_controller.rb +++ b/app/controllers/redactions_controller.rb @@ -25,7 +25,7 @@ class RedactionsController < ApplicationController # 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" @@ -42,7 +42,7 @@ class RedactionsController < ApplicationController @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" @@ -54,14 +54,14 @@ class RedactionsController < ApplicationController @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 - flash[:error] = t("redaction.destroy.error") + flash[:error] = t(".error") redirect_to @redaction end else - flash[:error] = t("redaction.destroy.not_empty") + flash[:error] = t(".not_empty") redirect_to @redaction end end diff --git a/app/views/redactions/edit.html.erb b/app/views/redactions/edit.html.erb index 2dd63c9cb..fe85d0756 100644 --- a/app/views/redactions/edit.html.erb +++ b/app/views/redactions/edit.html.erb @@ -1,22 +1,21 @@ -<% @title = t 'redaction.edit.title' %> +<% @title = t '.title' %> <% content_for :heading do %> -

<%= t 'redaction.edit.heading' %>

+

<%= t '.heading' %>

<% end %> <%= form_for(@redaction) do |f| %> <%= f.error_messages %>

- <%= f.label :title, t('redaction.edit.title') %>
+ <%= f.label :title, t('.title') %>
<%= f.text_field :title %>

- <%= f.label :description, t('redaction.edit.description') %>
+ <%= f.label :description, t('.description') %>
<%= richtext_area :redaction, :description, :cols => 80, :rows => 20, :format => @redaction.description_format %>

- <%= f.submit t('redaction.edit.submit') %> + <%= f.submit t('.submit') %>

<% end %> - diff --git a/app/views/redactions/index.html.erb b/app/views/redactions/index.html.erb index a5a85c38d..b53e9b747 100644 --- a/app/views/redactions/index.html.erb +++ b/app/views/redactions/index.html.erb @@ -1,10 +1,10 @@ -<% @title = t('redaction.index.title') %> +<% @title = t('.title') %> <% content_for :heading do %> -

<%= t('redaction.index.heading') %>

+

<%= t('.heading') %>

<% end %> <% unless @redactions.empty? %> <%= render :partial => 'redactions' %> <% else %> -

<%= t 'redaction.index.empty' %>

+

<%= t '.empty' %>

<% end %> diff --git a/app/views/redactions/new.html.erb b/app/views/redactions/new.html.erb index 5004c0e1e..e6838073d 100644 --- a/app/views/redactions/new.html.erb +++ b/app/views/redactions/new.html.erb @@ -1,22 +1,20 @@ -<% @title = t 'redaction.new.title' %> +<% @title = t '.title' %> <% content_for :heading do %> -

<%= t 'redaction.new.heading' %>

+

<%= t '.heading' %>

<% end %> <%= form_for(@redaction) do |f| %> <%= f.error_messages %>

- <%= f.label :title, t('redaction.new.title') %>
+ <%= f.label :title, t('.title') %>
<%= f.text_field :title %>

- <%= f.label :description, t('redaction.new.description') %>
+ <%= f.label :description, t('.description') %>
<%= richtext_area :redaction, :description, :cols => 80, :rows => 20, :format => @redaction.description_format %>

- <%= f.submit t('redaction.new.submit') %> + <%= f.submit t('.submit') %>

<% end %> - - diff --git a/app/views/redactions/show.html.erb b/app/views/redactions/show.html.erb index 99f7cd1f1..8ec72f3ac 100644 --- a/app/views/redactions/show.html.erb +++ b/app/views/redactions/show.html.erb @@ -1,20 +1,20 @@ -<% @title = t('redaction.show.title') %> +<% @title = t('.title') %> <% content_for :heading do %> -

<%= t('redaction.show.heading', :title => @redaction.title) %>

+

<%= t('.heading', :title => @redaction.title) %>

<% end %>

- <%= t 'redaction.show.user' %> + <%= t '.user' %> <%= link_to(@redaction.user.display_name, user_path(@redaction.user)) %>

- <%= t 'redaction.show.description' %> + <%= t '.description' %> <%= @redaction.description.to_html %>

<% if current_user and current_user.moderator? %>
- <%= button_to t('redaction.show.edit'), edit_redaction_path(@redaction), :method => :get %> - <%= 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 %> + <%= button_to t('.destroy'), @redaction, :method => "delete", :remote => true, :data => { :confirm => t('.confirm') } %>
<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index b31ce4d5d..f5a13ef85 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2401,7 +2401,7 @@ en: show_address: Show address query_features: Query features centre_map: Centre map here - redaction: + redactions: edit: description: "Description" heading: "Edit redaction"