CMW
CMW

Reputation: 3144

Is there a way to internationalize/localize model values?

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) %>

Upvotes: 1

Views: 60

Answers (2)

CMW
CMW

Reputation: 3144

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.

Upvotes: 2

chumakoff
chumakoff

Reputation: 7054

This gem may help https://github.com/globalize/globalize

I hope you will find this information useful.

Upvotes: 2

Related Questions