Ask A Question

Notifications

You’re not receiving notifications from this thread.

Creating an application Multi Language

Kelvin Firmino asked in Rails

Hi, good evening.

Cris, I would like to create a system which will suport many language. For instance, I would like to be able to access the languages using URL like:

https://www.mysite.com/us/
https://www.mysite.com/es/
https://www.mysite.com/br/

How is the best way to implement it?

Secondly, Imagine that is it a game application where I will be able to save the monsters data like having more than 30 colums representing the monster information like:

id, name, info1, info2, ..., info30.

How the database should be model to be able to manage multi-language? I suppose that create 30+ columns for each language would not be a good idea. Keeping in mind that it could be translate for mor than 5 languages.

If I create one table to each language, how could Active model handle the right table to get the correct data?

The same would apply to create posts to this website, the post would be translate for all the language supported.

Thanks for your time and attention.

Sincerely,

Kelvin Firmino

Reply

Hey Kelvin,

I'm not too familiar with it, but you might try this gem: https://github.com/globalize/globalize

It can help you on the ActiveRecord model side to handle languages using a translations table it looks like.

Reply

Ok, thanks.

I will check this gem.

Reply

Great app! And most of all I liked that it is configured for different language versions, which is very convenient for a user from any corner of the world.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.