I have some translations in my Rails application (config/locale/[en|de].yml) and I use it in my views with <%=t "teasers.welcome" %>. Example:
teasers: welcome: "<strong>Welcome</strong> to the Website ..." In Rails 2.3.8 this works just fine, with Rails 3, the HTML is escaped and translated to <... How can I prevent this form this translation and use HTML in my translation files like in Rails 2.3.8?
Other than using raw, there's an other undocumented (but official) way to do so. All keys ending with _html are automatically rendered unescaped.
Rename the key from
teasers: welcome: "<strong>Welcome</strong> to the Website ..." to
teasers: welcome_html: "<strong>Welcome</strong> to the Website ..."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With