Reputation: 35
I need to add a variable in a translation key in a view of a Ruby on Rails project (not in the value, in the key). Ex, this is my key:
= t 'services.categories.website_html'
What I need to do is that the word "website" from that key comes from a variable named "category.className"
I have tryed this, with no results:
= t 'services.categories.#{category.className}_html'
Thanks in advance.
Upvotes: 1
Views: 123
Reputation: 2588
Use double quotes instead of simple quotes ;)
= t "services.categories.#{category.className}_html"
Strings are not interpolated inside single quotes, but they are in double quotes.
Upvotes: 1