Rails/Devise - 在语言环境文件中添加 ruby​​ 代码?

发布于 2024-09-28 13:18:46 字数 257 浏览 0 评论 0原文

我想知道是否有办法在语言环境文件中添加 ruby​​ 代码。例如:

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

谢谢您的帮助!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伊面 2024-10-05 13:18:46

我过去解决这个问题的方法是:

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

然后在你需要输出的地方:

t('devise.failure.unconfirmed',
  :confirm_link => link_to(
                           t('devise.failure.confirm_link_text'), 
                           user_confirmation_path)
                          )

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)
                          )
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文