Demo of Rails 2.2 internationalization
Posted by David August 27, 2008 @ 10:12 PM
Rails 2.2 is going to make it much, much easier to do internationalized sites. Check out Clemens Kofler’s sample app running live or peruse his code. Thread safety? Internationalization? What stock objections to Rails will we have left?!

Sweetness!
Excellent, a lot of useful stuff there. The gears are already turning in my head … my wife will not be pleased.
Apparently Rails doesn’t scale still. That’s just what I heard on the street.
I believe I was on the same street as Dr. Nic. There was some dude singing a song about it…
Well, with all these features it’s too enterprisey!
I kid… I kid!
:)
hmm .. if this make rails goes too big, should it be written as a plugin or ‘gem’ instead? something like .. rails_i18n gem :P
One should probably also mention the great work some of the other guys have done, namely Fabio Akita (akitaonrails), Simon Tokumine (tokumine) and Masayuki Nakamura. I’ll try to merge their changes back to the original repo (http://github.com/clemens/i18n_demo_app/tree/master) when I find the time.
internationalization is definitely the most anticipated feature for the non-English speaking developers. :)
Actually, the i18n code is the effort towards internationalization of Rails. The process of actually adapting your site to a specific locale is called localization.
See: http://en.wikipedia.org/wiki/Internationalization_and_localization
The most interesting thing is: Does it allow to i18n validation messages? Both buildin as well as custom messages? My Rails 2.1 solution is not very pretty and I’d love to see an improvement here.
Hi all,
if you wanna play with the Rails i18n, try as well this application: http://github.com/karmi/rails_i18n_demo_app/ . It is a working mini-application including locale setting, switching and loading, default en-US locale file, Czech localization in Ruby hash and German localization in YAML, and demonstrates localization of Strings, Date&Time, Numbers, ActiveRecord messages.
Also check Sven Fuchs’ fork for “edge” experiments with i18n gem like advanced pluralization rules: http://github.com/svenfuchs/rails_i18n_demo_app/
Karel
when selecting a language where there is no translation is it possible to show the default strings (ex: English) instead of the horrible variables that a user wouldn’t understand?
Really great work guys been waiting for this.
@alib: It is, check http://github.com/karmi/rails_i18n_demo_app/tree/master/app/views/home/index.html.erb#L3
Thanks much for the announcement, David!
To clarify the scope for the I18n api (i guess we’ll have to say this a couple of times in the near future) ... this is not a fullblown (and heavyweight) Localization solution baked right into Rails.
Instead it is two things: a) a common API where we can build our L10n solutions on (this is what we call the I18n api) and b) a Simple backend which (might be used for other purposes) but has the sole requirement to localize Rails back to en-US.
:)
Stock objection:
The code for Rails is still hideously ugly.
Bob Aman: what do you mean? drop a gitlink please?
Personally, I think Rails should be more modular: hell, i don’t need generators on production.
Great demo! I think 99translations.com has pretty interface to edit these translations files .
This is super usefull! And very nice demo! Waiting for the 2.0 :)
internationalization means also that stuff like validates_numericality_of :field accept numbers as 13.0, but also like 13,0 ? (i know, english is different, more like 1,300.00…but some country use like 1’300,00 or worst 1.300,00…any idea how to accept both? :(
Why 13? a little bit much.
It’s a great demo! Excellent, a lot of useful stuff there …
This is very cool. Unfortunately the demo has the wrong settings for en-US localizations. I’ve fixed this in my fork and issued a pull-request, so hopefully it will be fixed in the main master.
It’s quite easy to fix yourself, or you can get my fork: http://github.com/brandondrew/i18n_demo_app/tree/master
I really hate the i18n.t() notation! It’s not natural language like the most of Rails is! Even “intl” is much more meaningful than that cryptic and nerdy (and enterprisey?) i18n! Wasn’t it possible to make it just t() or text() or phrase() or something similar at least within .erb?
Clemens did a great job, it looks really nice! You guys rule!
Demo link does not work – bad gateway.
@Nikolay Kolev: “t” is just the abbreviated version for “translate”, so you can always use the longer version if you like :) You can also define your own method like “intl” and delegate to “translate”.
So, where the heck is 2.2 release schedule? I’ve been googling for 30 minutes and still can’t find it! Thanks!