Rails 3: Using HTML in i18n form helper translations

I am using the automatic form label helper for creating my form labels and having them translated via the i18n support, however, I want to have HTML in the label and I can't figure out how to make it HTML safe.

For example:

en:
  helpers:
    label:
      product:
        name: 'Your Product Name <small>Try to be creative</small>'

Ends up as:

<label for="product_name">Your Product Name &lt;Try to be creative&gt;</label>

But I want it to be:

<label for="product_name">Your Product Name <small>Try to be creative</small></label>

Is there a way for me to specify the translation as html_safe so that it doesn't get encoded before the output?

Also, this seems like the most semantic way for the HTML to be setup but I am open to suggestions if I am approaching this entirely the wrong way.

Thanks :)

Updated:

<%= form_for @product do |f| %>
  <%= f.label :name %>
  <%= f.text_field :name %>
<% end %>
10
задан Jeremy Baker 7 December 2010 в 04:07
поделиться