views:

172

answers:

2

I am writing a site with more than one language, is there any easy way or technique to reduct the workload of changing which text to another language.I have an idea, but I don't know whether it is suitable or easy enough. I create a XML that contain all the text in my web, when the user change their language, my program will base on the language the user choose, and get the suitable tags from the XML, and fill in the page. What do you think? or maybe is there any more easy way to do?

(Assuming I am using RoR, if suggest any gems.)

+3  A: 

Check out Rails Internationalization (I18n) API:

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.

Mitch Wheat
A: 

I wrote a blog post about "Scoping By Locales". It suggests to put all your content in the database and when you want to fetch it, use the I18n API to set the user's locale to be their language and the fetcher will default to that language.

Ryan Bigg