views:

23

answers:

1

Hi,

I would like to know if there is a way to add ruby code in a locale file. For example:

  devise:
    failure:
      unconfirmed: 'You have to confirm your account before continuing. <%= link to "send confirmation instructions?", user_confirmation_path %>'

Thanks for your help!

+1  A: 

The way I have solved this in the past is:

devise:
  failure:
    unconfirmed: 'You have to confirm your account before continuing. {{confirm_link}}.'
    confirm_link_text: "send confirmation instructions?"

Then where you need the output:

t('devise.failure.unconfirmed',
  :confirm_link => link_to(
                           t('devise.failure.confirm_link_text'), 
                           user_confirmation_path)
                          )
Shadwell
it works great. I've just have to add .html_safe, but using devise as my authentication solution, I don't know where I have to put the output. Thanks for any idea!
benoitr