Add _html suffixes to some resource strings which have changed

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.
This commit is contained in:
Tom Hughes 2012-03-14 17:51:42 +00:00
parent fe5cbadf3d
commit 0884e7b431
2 changed files with 6 additions and 6 deletions

View file

@ -73,13 +73,13 @@
<%= t 'layouts.intro_1' %> <%= t 'layouts.intro_1' %>
</p> </p>
<p> <p>
<%= raw(t 'layouts.intro_2', <%= t 'layouts.intro_2_html',
:download => link_to(t('layouts.intro_2_download'), "http://planet.openstreetmap.org/"), :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')), :use => link_to(t('layouts.intro_2_use'), t('layouts.intro_2_use_url')),
:license => link_to(t('layouts.intro_2_license'), :license => link_to(t('layouts.intro_2_license'),
url_for({:controller => 'site', :action => 'copyright'})), url_for({:controller => 'site', :action => 'copyright'})),
:create_account => link_to(t('layouts.intro_2_create_account'), :create_account => link_to(t('layouts.intro_2_create_account'),
url_for({:controller => 'user', :action => 'new'}))) url_for({:controller => 'user', :action => 'new'}))
%> %>
</p> </p>
</div> </div>
@ -131,11 +131,11 @@
<a href="http://donate.openstreetmap.org/" title="<%= h(t('layouts.make_a_donation.title')) %>"><%= h(t('layouts.make_a_donation.text')) %></a> <a href="http://donate.openstreetmap.org/" title="<%= h(t('layouts.make_a_donation.title')) %>"><%= h(t('layouts.make_a_donation.text')) %></a>
</div> </div>
<div class='sidebar-copy'> <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"), :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/"), :ic => link_to(t('layouts.partners_ic'), "http://www.imperial.ac.uk/"),
:bytemark => link_to(t('layouts.partners_bytemark'), "http://www.bytemark.co.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> </p>
</div> </div>

View file

@ -974,13 +974,13 @@ en:
edit_with: Edit with %{editor} edit_with: Edit with %{editor}
tag_line: The Free Wiki World Map tag_line: The Free Wiki World Map
intro_1: "OpenStreetMap is a free worldwide map, created by people like you." 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_create_account: "Create a user account"
intro_2_license: "open license" intro_2_license: "open license"
intro_2_use: "use" intro_2_use: "use"
intro_2_download: "download" intro_2_download: "download"
intro_2_use_url: "http://wiki.openstreetmap.org/wiki/Using_OpenStreetMap" 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_ucl: "the UCL VR Centre"
partners_ic: "Imperial College London" partners_ic: "Imperial College London"
partners_bytemark: "Bytemark Hosting" partners_bytemark: "Bytemark Hosting"