Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to internationalize content on ruby on rails?

How can I internationalize say a categories table (with a name column) into different languages. How about a products table (consisting of a name and description columns). Which is the best way to internationalize the content of these database tables using Ruby on Rails?

like image 775
user177468 Avatar asked Oct 02 '09 06:10

user177468


People also ask

What is i18n in Ruby?

The Ruby I18n (shorthand for internationalization) gem which is shipped with Ruby on Rails (starting from Rails 2.2) provides an easy-to-use and extensible framework for translating your application to a single custom language other than English or for providing multi-language support in your application.

What is the difference between i18n and l10N?

To sum up, the distinction between these terms is the following: Localization (l10N) involves adapting your product or content to particular locales. Internationalization (i18n) is the process of preparing your software-based product for localization.

What is i18?

Internationalization (sometimes shortened to "I18N , meaning "I - eighteen letters -N") is the process of planning and implementing products and services so that they can easily be adapted to specific local languages and cultures, a process called localization .

Why is it called i18n?

Internationalization (i18n) Example Internationalization is also called i18n (because of the number of letters, 18, between “i” and “n”). Internationalization ensures your software is localizable and is typically done by software developers and engineers.


2 Answers

Have you taken a look at: http://guides.rubyonrails.org/i18n.html

It describes in some detail how to internationalise your application and

"provides an easy-to-use and extensible framework for translating your application to a single custom language other than English or for providing multi-language support in your application."

Some useful links:

  • http://rails-i18n.org/
  • http://github.com/svenfuchs/rails-i18n
  • http://github.com/svenfuchs/rails-i18n/tree/master/rails/locale

Update: 2018

Since answering this question nearly nine years ago, the same author of i18n has created Globalize which builds on the I18n API in Ruby on Rails to add model translations to ActiveRecord models.

Please find details here: https://github.com/globalize/globalize

like image 147
Spasm Avatar answered Oct 28 '22 15:10

Spasm


On RailsCasts there is a nice article about, using a gem called Globalize3. That just let you set which Models will be translated and manage a translate tables for each model, and works just like i18n is to static pages...

Take a look

http://railscasts.com/episodes/338-globalize3?view=asciicast

like image 30
cefigueiredo Avatar answered Oct 28 '22 13:10

cefigueiredo