'Rails a href in devise translation .yml
In my Rails 5 app I want to display custom error message if the user enters the password incorrectly for a custom strategy method. What I did is:
devise.en.yml
en:
devise:
failure:
custom_auth: "Email is already registered. \nPlease login <a href='https://www.some_page.com'>Some Page</a> or create an account with a different email address.
But it won't worked, the same as:
custom_auth: "Email is already registered. \nPlease login [Some Page](https://www.some_page.com/login) or create an account with a different email address.
Solution 1:[1]
Most likely you need to use html_safe, as in I18n.t("devise.failure.custom_auth").html_safe - otherwise the translation will be escaped, and the link will not work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | eugen |
