It’s easy to pass variables to your Rails translation files.
For example…
In the translation file:
1 2 3 |
en: greeting: "Hi %{name}. Welcome to the dashboard." |
In the view:
1 |
<%=t(:greeting, name: current_user.first_name) %> |
Read more: Rails Guides 18n Interpolation