display website content in multilanguage

There is some new stuff coming out in edge for this, but, in production we are using the getText gem. It is great because it dumps to industry standard .po files which we send off for translation.

You simply mark all strings like this: <%= _("Hello World")%> in your views, or just _("Hello") in your code and running the updatepo task will find them and dump them to file.

I've been doing multilingual sites for a long time and found this tool to be one of the best. A lot of people like Globalize, but personally I don't like the idea of storing everything in the database as you then have to give your translators access to the db and they have to learn a new tool. The translation company we use already use and know poEdit.

We are at the point now where we can add a new language to our system in just a couple of hours (new translations and a few new images).

I find this quite interesting, but how would it work with text that's not coming directly from the app, but a database?

You can't just say <%= _(@product.category.name) => , right?

We treat 'data' based translations differently, sorry. Didn't think about that when I wrote the above. We have a general translations table that we use for stuff like that and do a lookup on it (caching the result).

So something like

class Translation < ActiveRecord::Base def self.translation(str, lang) Translation.find_by_base_and_lang(str,lang) end end

That is very rough and off the top of my head as I don't have the code in front of me. I keep meaning to write up how we do this on my blog, but haven't yet. there are pros and cons to this approach. It really comes down to how much you are translating.