rails i18n - translating text with links inside

后端 未结 9 790
名媛妹妹
名媛妹妹 2020-11-30 21:05

I\'d like to i18n a text that looks like this:

Already signed up? Log in!

Note that there is a link on the text. On this example

9条回答
  •  渐次进展
    2020-11-30 21:44

    en.yml

    log_in_message_html: "This is a text, with a %{href} inside."
    log_in_href: "link"
    

    login.html.erb

    <%= t("log_in_message_html", href: link_to(t("log_in_href"), login_path)) %>

提交回复
热议问题