Rails 3: Using HTML in i18n form helper translations
The way to make a normal key automatically html safe in rails3 is to append _html or .html to the key name. E.g. name_html. This only works via the translate/t method in the view, i.e. not via I18n.t This isn't going to work here anyway though as the standard form helper doesn't try that version of the key.
Creating your own form builder is the way to go as suggested. You could also do
f.label :name, t('helpers.label.product.name_html')
If this only happens in a couple of places.
Don't know how your actual helper is, but you could use html_safe
to do that easily (provided that your label's value won't be input by other users).
something like: t("helpers.label.product.name").html_safe
If this is not working, please give your implementation of your helper method, or only the lines for outputting the result.
====== UPDATED ======
Thanks to your updated code, now I know what's the best answer :D
I don't know too if you really want helpers.label.product.name
.
But there is another way I think would be better, which is define as he following:
en:
activerecord:
attributes:
product:
labels:
name: "Your Product Name <small>Try to be creative</small>"
If you don't want to build your own custom form builder, use this:
= f.label :name, Product.human_attribute_name("labels.name").html_safe
Actually if you define your own form builder, it easy redefine the label method to generate it's text automatically.