Skip to content

Instantly share code, notes, and snippets.

@hemju
Created April 26, 2012 15:37
Show Gist options
  • Save hemju/2500433 to your computer and use it in GitHub Desktop.
Save hemju/2500433 to your computer and use it in GitHub Desktop.
three ways to use HTML in Rails translations
1: <%= t 'html.escaped' %> <!-- INCORRECT RESULT: &lt;h2&gt;lingohub&lt;/h2&gt;&lt;p&gt;can't wait to see it&lt;/p2&gt; -->
2: <%= raw t('html.raw') %> <!-- CORRECT RESULT: <h2>lingohub</h2><p>can't wait to see it</p> -->
3: <%= t('html.html_safe').html_safe %> <!-- CORRECT RESULT: <h2>lingohub</h2><p>can't wait to see it</p> -->
4: <%= t 'html.ending_html' %> <!-- CORRECT RESULT: <h2>lingohub</h2><p>can't wait to see it</p> -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment