Internationalizing dynamic content in Rails
We want to build a app where we would like to show translated version of dynamic content as well. The transalted content would be uploaded by us (so we don't need any translation logic).
I was wondering if there any other gems to c开发者_Go百科onsider apart from the built-in i18n? i18n seems to be best for static data, but does not handle dynamic data.
I think Globalize2 might be what you are looking for, but it looks to be a bit outdated as the last announcement is that they support Ruby 1.2. However, the last push to the repo was on November 19th, so it might just be that the webpage is outdated.
I worked on a similar situation. I developed a model to store multi-lingual data in the database without having to build a look-up table. The benefit of doing it this way is that it requires very little schema changes. Feel free to ask me any questions or post on the blog if you need help with anything.
Internationalization Blog Post: http://lanitdev.wordpress.com/2009/06/23/internationalization-data-storage-in-net-part-1/
Thanks
Andrew
I wrote a small plugin that might be useful for this : http://github.com/nmindia/has_translations
There's globalize that might help you.
It allows you to add translated fields in your models.
And when you get the field's data, it retrieves the appropriate language's content.
Globalize is a great plugin. You couldn't miss the same great tutorial about it on http://www.artweb-design.de/2006/11/10/get-on-rails-with-globalize-comprehensive-writeup.
However, it stores strings of all locales in a single database table. So it may brought 2 problems: 1. performance if your project is large; 2. How to get professional translators to cooperate.
So ruby-gettext-package is also an option. It natually avoids the 2 problems above.
精彩评论