From: Andy Allan Date: Wed, 6 Jun 2018 05:24:01 +0000 (+0800) Subject: Fix lazy i18n lookups for browse error pages X-Git-Tag: live~2962^2~1 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/25c2feaec91aad00999afff804a11b4ab84402b8?ds=sidebyside 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 --- 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] %>