On 02 Apr 2008, at 08:27, san 1981 wrote:
I’m a newbie on the rails environment. I’ve just created an
application.html.erb to have the same layout on all pages but the site
will be available in 2 different languages, then with 2 different
Then I would like to have an application.html.erb with the layout in
French and an application.html.erb with the layout in English.
Depending on your needs, there are a few solutions out there:
These are the ones I’ve used so far:
Localization plugin: http://agilewebdevelopment.com/plugins/localization
Very good for simple translations with a language file similar to what
you found in older php applications (basically a key with the
translation). This is in case you don’t need model translations,
number formatting etc. It has a number of disadvantages, such as
needing to restart the server if you want translations to be reloaded.
Another lightweight translation plugin, but uses yaml files. You don’t
need to restart your webserver for the language files to reload. Has a
number of extra plugins out there that extend its functionality
). That said, it’s syntax was too verbose for me.
It’s the heavyweight amongst the translation plugins, has just about
everything you’ll ever need and it’s heavy on resources too (no matter
what caching is put in place in the plugin already, it drains
performance quite a bit). It uses your database for translations. The
best way to see what I mean is by doing a small profiling of your
applications before using globalize, by installing it and translating
a few views, then do the same profiling. While it is quite normal you
see a bit of a performance hit, that of globalize is quite huge at
each level (database and rendering). But, as I said, if you really
need everything that can be internationalized, this plugin will
probably be your best choice.
There’s also simple_localization, where simple in its name must be
about its complexity, not its featureset:
I’m certainly tempted to try it out, it looks clean, has a nice
featureset, Rails 2 compatible and not too bloated.
Peter De Berdt