From 06d73857d1fe6e069d006aedcca2c447cce533ad Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Thu, 12 Aug 2021 16:26:21 +0100 Subject: [PATCH] Avoid using raw html in translations for links. 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 | 2 +- config/locales/en.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 1dd84edea..be25df193 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -191,7 +191,7 @@
<% if @user.home_lat.nil? or @user.home_lon.nil? %>
-

<%= t(".set_location_html", :edit_profile_url => edit_profile_path) %>

+

<%= t(".no_home_location_html", :edit_profile_link => link_to(t(".edit_your_profile"), edit_profile_path)) %>

<% else %> <% content_for :head do %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 1b411a229..430836bce 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2505,7 +2505,8 @@ en: spam score: "Spam Score:" description: Description user location: User location - set_location_html: "Edit your profile 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" -- 2.43.2