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?
+5
A:
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:
Spasm
2009-10-02 06:51:44
+1
A:
If you want to store the values for the different languages in the db next to the standard Rails i18n (yml), you could do something like this:
Products table name field:
- name_en
- name_fr
- name_nl
Fetch the correct value:
def i18n_db_value(object, attribute)
object.send("#{attribute.to_s}_#{I18n.locale}") if object
end
atog
2009-10-02 10:35:11