diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-06-24 09:20:10 -0700 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-06-24 09:20:10 -0700 |
commit | 7c15ac4dd0e5ed27be6d75bda8de278ef45da0aa (patch) | |
tree | b4d9c373e72b7226f3d3c503e8f08e54003fb3e1 | |
parent | 6875d9942c423c1114c7a3f9b9c27ac601599f2d (diff) |
Split the string interpolation and translation into two steps so that the translation gets picked up by rake gettext:find. Add a bit more explanation.
-rw-r--r-- | app/models/user.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 306d6ad4a..9da4ad743 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -107,8 +107,11 @@ class User < ActiveRecord::Base end if self.public_banned? # Use interpolation to return a string rather than a SafeBuffer so that - # gsub can be called on it until we upgrade to Rails 3.2 - name = "#{_("{{user_name}} (Account suspended)", :user_name=> name)}" + # gsub can be called on it until we upgrade to Rails 3.2. The name returned + # is not marked as HTML safe so will be escaped automatically in views. We + # do this in two steps so the string still gets picked up for translation + name = _("{{user_name}} (Account suspended)", :user_name=> name.html_safe) + name = "#{name}" end name end |