]> git.openstreetmap.org Git - rails.git/commitdiff
Add _html suffixes to some resource strings which have changed
authorTom Hughes <tom@compton.nu>
Wed, 14 Mar 2012 17:51:42 +0000 (17:51 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 14 Mar 2012 18:29:04 +0000 (18:29 +0000)
Where a translatable string contains (directly or indirectly via
interpolations) some HTML it is better to add an _html suffix to
the key rather than wrap the result in raw so that escaping is
handled automatically for interpolations.

It's not worth doing until a string is changed and needs to be
retranslated though, as it will just break translations.

app/views/layouts/site.html.erb
config/locales/en.yml

index 19835489c65b4e4b059d336b090e2f3666d481cb..4c12bfe141d0ff589187ae3f05a719b6ea3b1506 100644 (file)
           <%= t 'layouts.intro_1' %>
         </p>
         <p>
           <%= t 'layouts.intro_1' %>
         </p>
         <p>
-        <%= raw(t 'layouts.intro_2',
+        <%= t 'layouts.intro_2_html',
                 :download => link_to(t('layouts.intro_2_download'), "http://planet.openstreetmap.org/"),
                 :use => link_to(t('layouts.intro_2_use'), t('layouts.intro_2_use_url')),
                 :license => link_to(t('layouts.intro_2_license'),
                                    url_for({:controller => 'site', :action => 'copyright'})),
                 :create_account => link_to(t('layouts.intro_2_create_account'),
                 :download => link_to(t('layouts.intro_2_download'), "http://planet.openstreetmap.org/"),
                 :use => link_to(t('layouts.intro_2_use'), t('layouts.intro_2_use_url')),
                 :license => link_to(t('layouts.intro_2_license'),
                                    url_for({:controller => 'site', :action => 'copyright'})),
                 :create_account => link_to(t('layouts.intro_2_create_account'),
-                                   url_for({:controller => 'user', :action => 'new'})))
+                                   url_for({:controller => 'user', :action => 'new'}))
         %>
         </p>
       </div>
         %>
         </p>
       </div>
         <a href="http://donate.openstreetmap.org/" title="<%= h(t('layouts.make_a_donation.title')) %>"><%= h(t('layouts.make_a_donation.text')) %></a>
       </div>
       <div class='sidebar-copy'>
         <a href="http://donate.openstreetmap.org/" title="<%= h(t('layouts.make_a_donation.title')) %>"><%= h(t('layouts.make_a_donation.text')) %></a>
       </div>
       <div class='sidebar-copy'>
-          <p><%= raw(t 'layouts.partners',
+          <p><%= t 'layouts.partners_html',
               :ucl => link_to(t('layouts.partners_ucl'), "http://www.vr.ucl.ac.uk"),
               :ic => link_to(t('layouts.partners_ic'), "http://www.imperial.ac.uk/"),
               :bytemark => link_to(t('layouts.partners_bytemark'), "http://www.bytemark.co.uk"),
               :ucl => link_to(t('layouts.partners_ucl'), "http://www.vr.ucl.ac.uk"),
               :ic => link_to(t('layouts.partners_ic'), "http://www.imperial.ac.uk/"),
               :bytemark => link_to(t('layouts.partners_bytemark'), "http://www.bytemark.co.uk"),
-              :partners => link_to(t('layouts.partners_partners'), t('layouts.partners_url'))) %>
+              :partners => link_to(t('layouts.partners_partners'), t('layouts.partners_url')) %>
           </p>
       </div>
 
           </p>
       </div>
 
index 1cec3f1486fc94007269a978289b716a789977f5..766d619184047ddf8f51725b52550763e701f0d3 100644 (file)
@@ -974,13 +974,13 @@ en:
     edit_with: Edit with %{editor}
     tag_line: The Free Wiki World Map
     intro_1: "OpenStreetMap is a free worldwide map, created by people like you."
     edit_with: Edit with %{editor}
     tag_line: The Free Wiki World Map
     intro_1: "OpenStreetMap is a free worldwide map, created by people like you."
-    intro_2: "The data is free to %{download} and %{use} under its %{license}. %{create_account} to improve the map."
+    intro_2_html: "The data is free to %{download} and %{use} under its %{license}. %{create_account} to improve the map."
     intro_2_create_account: "Create a user account"
     intro_2_license: "open license"
     intro_2_use: "use"
     intro_2_download: "download"
     intro_2_use_url: "http://wiki.openstreetmap.org/wiki/Using_OpenStreetMap"
     intro_2_create_account: "Create a user account"
     intro_2_license: "open license"
     intro_2_use: "use"
     intro_2_download: "download"
     intro_2_use_url: "http://wiki.openstreetmap.org/wiki/Using_OpenStreetMap"
-    partners: "Hosting is supported by %{ucl}, %{ic} and %{bytemark}, and other %{partners}."
+    partners_html: "Hosting is supported by %{ucl}, %{ic} and %{bytemark}, and other %{partners}."
     partners_ucl: "the UCL VR Centre"
     partners_ic: "Imperial College London"
     partners_bytemark: "Bytemark Hosting"
     partners_ucl: "the UCL VR Centre"
     partners_ic: "Imperial College London"
     partners_bytemark: "Bytemark Hosting"