문제

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!

도움이 되었습니까?

해결책

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)
                          )
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top