]> git.openstreetmap.org Git - rails.git/commitdiff
Avoid using raw html in translations for links.
authorAndy Allan <git@gravitystorm.co.uk>
Thu, 12 Aug 2021 15:26:21 +0000 (16:26 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Thu, 12 Aug 2021 15:35:54 +0000 (16:35 +0100)
This is a followup to 26698d6 which introduced the html. It's better
to use interpolation for links, since this avoids the translations
from introducing html syntax errors.

I had to change the translation key, since changing the interpolation
variables alone would lead to breakages.

app/views/users/show.html.erb
config/locales/en.yml

index 1dd84edeaf4a581dd8a433a7616bab57675d2ce9..be25df1933d45cf28d026ad489479fa5931ddc10 100644 (file)
     <div class="col-md order-md-last">
       <% if @user.home_lat.nil? or @user.home_lon.nil? %>
         <div id="map" class="content_map">
-          <p id="no_home_location"><%= t(".set_location_html", :edit_profile_url => edit_profile_path) %></p>
+          <p id="no_home_location"><%= t(".no_home_location_html", :edit_profile_link => link_to(t(".edit_your_profile"), edit_profile_path)) %></p>
         </div>
       <% else %>
         <% content_for :head do %>
index 1b411a229dddf8f758dd913301c7f23506707d93..430836bce456d4db6cf53329f959ea75ffa26aa2 100644 (file)
@@ -2505,7 +2505,8 @@ en:
       spam score: "Spam Score:"
       description: Description
       user location: User location
-      set_location_html: "<a href=\"%{edit_profile_url}\">Edit your profile</a> and set your home location to see nearby users."
+      no_home_location_html: "%{edit_profile_link} and set your home location to see nearby users."
+      edit_your_profile: Edit your profile
       my friends: My friends
       no friends: You have not added any friends yet.
       km away: "%{count}km away"