I’m currently translating a application and i’ve stumbled upon a problem. I’m using this in my views:
t("page.text")
and i have this is my yaml file:
page:
text: "This is my tekst with a #{link_to "pages index, pages_path}"
This string gets outputted without the link_to logic in it, like this: “This is my tekst with a #{link_to “pages index, pages_path}”. This is not what i want, i want the string parsed with the link_to function like this: “This is my tekst with a pages index” where pages index links to the /pages route…
Thanks.
Rails’s i18n API allows you to use variable-based interpolation in your YAML file. To do what you’re trying to do:
You can read more about it in the official Rails Guide: http://guides.rubyonrails.org/i18n.html#interpolation