I have some view code:
<span data-something="[<%= t('.asd') %>, <%= t('.dsf') %>]></span>
I use this code to get some dynamic strings translated into the view. My YAML is something like:
en:
feature:
asd: "Asdddd"
dsf: "adasdsadasda"
Is there a way I can use to dynamically get all the "features" from the YAML by locale and put it in the data-attribute?
This is pretty simple to do:
I18n.translate('feature').values.join(', ')
You'll end up with a string "Asdddd, adasdsadasda".
I think it's as easy as t('feature') to get the hash, you might want to just have the values so could you try t('feature').keys?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With