Rails I18n字作为链接



在我的I18n文件中,我有以下翻译:

reservation:
  please_accept: "Please accept regulation"

在我看来,我是这样使用它的:

= t('reservation.please_accept')

现在我想把单词"regulation"作为一个链接到我的应用程序中的一些操作。我怎么做呢?

回答我的问题:

= t('reservation.please_accept', href: link_to(t('reservation.regulation_word'), '#', "data-toggle" => "modal", 'data-target' => "##{@car.id}")).html_safe
reservation:
    regulation_word: "regulamin"
    please_accept: "Proszę zaakceptować %{href} wypożyczalni"

最新更新