Search code examples
ruby-on-railspostgresqlrails-i18n

Saving an input field in different languages in Rails


Context In my bike reservation app, bike_owners can add a description in my app about the bike they are renting out.

As website visitors (customers) have the option to select a language (say English, French and German), I would like to give bike_owners the opportunity to create a separate description for every language.

As this is about users creating a descriptions for several languages, instead of my app being available in several languages I cannot seem to use the i18n classic approach.

Question How to deal with users providing input for a database table_column in multiple languages?

Potential approach There must be a smarter way to go about this, but the only solution I found/came up with to actually deal with inputs for multiple languages, is to actually create multiple columns in my database bike_table, each representing a description in an individual language (description_en, description_fr, description_de etc.).


Solution

  • Following Max suggestion, I used the Globalize gem. Works like a charm.