I have a following translation:
welcome: Hello there, %{general_kenobi}
Now I know, that I can put HTML tags in the translation, like <em> or so. But what if I want this general_kenobi to have my custom style? How do I implement it? I've tried to google it, but didn't find anythin useful (or maybe I'm just bad at googling). Thank in advance!
If you want to add something fancy like this to your locale you must add the _html extension to the key.
From the docs
Keys with a '_html' suffix and keys named 'html' are marked as HTML safe. When you use them in views the HTML will not be escaped.
en:
welcome_html: "<b>Bolded text</b>"
then just the regular stuff in your views
<%= t('welcome_html')
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