From 25c2feaec91aad00999afff804a11b4ab84402b8 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 6 Jun 2018 13:24:01 +0800 Subject: [PATCH] Fix lazy i18n lookups for browse error pages `I18n.t` doesn't support lazy lookups, whereas the equivalent rails `t` helper does. The code can also be simplified to avoid the lookup table. Fixes 1877 --- app/views/browse/not_found.html.erb | 14 +++----------- app/views/browse/timeout.html.erb | 10 +--------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/app/views/browse/not_found.html.erb b/app/views/browse/not_found.html.erb index 5fe22a68a..3c4e8a4c8 100644 --- a/app/views/browse/not_found.html.erb +++ b/app/views/browse/not_found.html.erb @@ -1,12 +1,4 @@ -<% - browse_not_found_type = { - 'node' => I18n.t('.type.node'), - 'way' => I18n.t('.type.way'), - 'relation' => I18n.t('.type.relation'), - 'changeset' => I18n.t('.type.changeset'), - }; -%> -

- - <%= t '.sorry', :type=> browse_not_found_type[@type] , :id => params[:id] %>

+ + <%= t ".sorry", :type => t(".type.#{@type}"), :id => params[:id] %> + diff --git a/app/views/browse/timeout.html.erb b/app/views/browse/timeout.html.erb index de102e60f..e6dd7b68d 100644 --- a/app/views/browse/timeout.html.erb +++ b/app/views/browse/timeout.html.erb @@ -1,12 +1,4 @@ -<% - browse_timeout_type = { - 'node' => I18n.t('.type.node'), - 'way' => I18n.t('.type.way'), - 'relation' => I18n.t('.type.relation'), - 'changeset' => I18n.t('.type.changeset'), - }; -%>
- <%= t '.sorry', :type=> browse_timeout_type[@type] , :id => params[:id] %> + <%= t '.sorry', :type => t(".type.#{@type}"), :id => params[:id] %>
-- 2.39.5