Skip to main content

Creating an application Multi Language

Rails • Asked by Kelvin Firmino

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


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.


Ok, thanks.

I will check this gem.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.