I use rails 3. Is there any easy way to tell I18n to respect 'html safness' of string used in interpolation and make all translated string html safe by default? So if I have this en.yml
:
en:
user_with_name: 'User with name <em>%{name}</em>'
and I use t('user_with_name', :name => @user.name)
, I get users name html escaped, but <em>
and </em>
is left as is?
Old question, but if someone wants to achieve this, here's the monkey patch I came up with :
Put this in an initializers and that's it! Works with Rails 3.2.6. Only marks the text in localization files as safe, not the interpolation parameters.