This gem may help https://github.com/globalize/globalize
I hope you will find this information useful.
题
Our users put documents into the database and provide e.g. names in different languages.
We store those in different DB fields, say name_en
, name_fr
, name_de
and so on.
My question is:
Does Rails have a mechanism (probably provided by i18n) that selects the right name based on the current language setting?
I imagine a call like:
<%= t(document, :name) %>
解决方案
This gem may help https://github.com/globalize/globalize
I hope you will find this information useful.
其他提示
While Anton pointed me in its direction I want it to have a separate answer, so this is what I think is the best solution to my particular problem:
Traco lets me stick with my current scheme of having translations of an attribute distributed of different columns in the same table.