Finally. Ruby on Rails gets internationalized

posted: July 19th, 2008 · by: Sven

in: Globalization, Programming · tagged as: , , ·  54 comments »

So, it’s getting real. Our changes to Rails have been merged back into master and will be released with Rails 2.2.

We’ve started this project in September 07. A couple of I18n plugin developers gathered to implement a Rails core patch which should make our lifes easier. We agreed on the following goal:

“Our goal with this work is to eliminate the need for monkey patching Rails in order to internationalize an application. We want to achieve this by implementing a minimal, common I18n API that can be leveraged by all I18n/L10n solutions.”

In hindsight we’ve initially tried to accomplish way to much. Everybody brought their experience and thinking about “good I18n practices” to the table - which proved extremely valuable because it forced everbody to push their own horizon. But it also resulted in something that would have been “just another Rails I18n solution” … build right into Rails. As such it would not have fully satisfied every one of us. Too heavyweight, too complicated, just too much of everything.

So with the beginning of 2008 our work slowed down, good new ideas kept popping up but eventually the project completely stalled and people focussed on other business. Apparently we needed a creative break.

Then in May we went back to the drawing board and came up with a fresh approach based on our previous experience. Now all of a sudden we were able to agree on a very slim and minimal implementation of our concepts that covers all of our requirements: it works as a Ruby gem and is suited not only for use in Rails, it adds only minimal load to Rails core and it still implements the common api that will allow I18n solutions to build on.

To me this project already proved extremely interesting and educating. Almost all of the ideas that are now implemented have been already present in our discussions last year. But even though we’ve went through lots of lots of discussions we initially just haven’t been able to shave the whole yak fur down to this minimal level.

I guess all of us learned a great deal about I18n. In fact some of us (including me) completely changed their minds about what’s useful, good practice and common need … and more importantly: what really can be omitted.

So, what’s in the box? And what’s not?

First of all, there still won’t be a fullblown one-fits-all I18n/L10n solution in Rails. Please, understand that. Rails still won’t be able to translate your application to your language as long it’s not very similar to US English.

Instead, Rails continues to be what it always was: a framework localized to en-US. But this time with a twist: it is also internationalized.

That means: all hardcoded message strings and logic that we’ve previously been monkey patching in all of our plugins are now abstracted out of the Rails core code (which we mean by the process of “internationalization”) and stored in a central place, accessible through a common interface.

We worked hard to stick to the principle of doing “the simplest thing that ever could work” with this. Rails itself won’t provide means to localize an application to anything else than en-US. Instead it ships with a solution that gets the job done and walks away.

Rails will ship with our I18n Ruby gem which consists of two parts:

  • The first part is the API itself which is just a Ruby module with a bunch of methods that will be used by Rails and delegate all requests to a backend.
  • The second part is the Simple backend which implements whatever is necessary to re-localize Rails back to en-US.

The Simple backend acutally might also work for simple localization tasks such as translating an error message to another language, but, really, that’s a side effect.

So what do we win?

The whole point of the exercise is: the Simple backend can be swapped with a different implementation that supports the same API. Future Rails I18n plugins will do exactly that.

E.g. there certainly will be backends that provide different pluralization rules, more powerful means to localize dates and numbers, persist translations in other formats (e.g. Gettext files or in the database). There might be backends that themselves provide some kind of a framework to support pluggable extensions and custom solutions for certain locales etc.

So if we still need to rely on plugins for our fullblown L10n support, what do we win then?

The short answer: A lot!

In the past I18n developers implemented their solutions for the same problems again and again. Our repeatedly reinvented wheels came with different flavours of syntax sugar and different bikeshed colors of monkey patches. The latter repeatedly broke when Rails moved by a millimeter and plugin developers had to fix their stuff.

I’m not saying that this situation was all bad. Actually I really believe that it was necessary for Rails’ ecosystem to experiment with all of these solutions. But we’ve arrived at a point where we can move on.

So with this patch applied Rails I18n developers can now build on what was extracted from former experience. Instead of reimplementing things over and over again they can focus on some of the more challenging features like localized inflections, special formattings for strings, dates, numbers etc.

We also hope that future solutions will be more exchangeable and pluggable. There hopefully won’t be the need to stick to a certain solution anymore just because it’s the only one supporting inflections for a certain locale. Or the only one with a strong Gettext backend. Or whatever special feature comes to mind.

Of course that’s still a long road ahead. But we believe that this step, the merge of the work of the “Rails I18n group”, will help a lot on the journey.

Get involved!

If you’d like to join us working on Ruby on Rails’s future I18n support, provide feedback or ask questions please do so! You can find our Google Group over at http://groups.google.com/group/rails-i18n.

This solution was developed by the Rails I18n group consisting of Matt Aimonetti, Joshua Harvey, Saimon Moore, Stephan Soller and myself, with the additional work, help and feedback of many other Rails I18n developers including Tore Darell, Chris Eppstein, Luca Guidi Samuel Lown Yaroslav Markin, Joshua Sierles, Julian ‘Julik’ Tarkhanov and others.

Leave a comment

54 Comments

  1. Saimon Moore said July 19th, 2008 at 02:57 PM  

    Yay :)

    Congrats to all…

  2. Trevor Turk said July 19th, 2008 at 08:01 PM  

    Congrats, and thanks so much for working to get this stuff into core!

  3. Torsten Becker said July 21st, 2008 at 10:51 AM  

    Congratulations! Job very well done!

  4. ruby on rails developer said August 12th, 2008 at 05:28 PM  

    Congratulations, and keep up the good work. I’ve not needed internationalization yet… but no doubt when the time comes I’ll be forever in your debt.

  5. txapelgorri said August 28th, 2008 at 09:02 PM  

    Congratulations:

    I recently start with Rails, and everything seems to be sweet and calm, but I’ve realized that localization is the first big rock on my road. I hope this project to be the right step into the right direction.

  6. Simon H said October 30th, 2008 at 10:42 AM  

    I’m excite to see Ruby moving towards better l10n support, but I’m confused by the language you use to describe your work - you’ve repeatedly mixed the terms i18n and l10n in the text above, but you only seem to be describing l10n features - translation, pluralisation etc. Are you doing any work relating to character sets, Unicode, etc? I came here from http://rails-i18n.org and I noticed the same problem over there - lots of talk about “Internationalization will be solved”, but only solutions for l10n problems.

    Am I missing something?

  7. grosser said February 21st, 2009 at 01:44 PM  

    there finally is a gettext based solution for rails i18n:

    fast+threadsave+simple Gettext http://github.com/grosser/fast_gettext

    2.2+ rails plugin for gettext and i18n http://github.com/grosser/gettexti18nrails

    Example 2.3 application fastgettext+i18n http://github.com/grosser/gettexti18nrailsexample

  8. Sven said April 8th, 2009 at 04:13 PM  

    Thanks for the headsup, Michael!

    I’ve added these links to the rails-i18n wiki: http://rails-i18n.org/wiki

  9. Exchange said September 15th, 2010 at 04:06 AM  

    Thanks for sharing this great article! That is very interesting Smile I love reading and I am always searching for informative information like this.

  10. jack said January 23rd, 2011 at 10:37 AM  

    This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.. cheap vps

  11. StevenToff said February 3rd, 2011 at 09:47 AM  

    Internationalization is definitely the most anticipated feature for the non-English speaking developers. male enhancement pills)

  12. Alison said February 3rd, 2011 at 06:39 PM  

    As you know that I don’t need rails right now (which btw, I have no knowledge in). I just need to work in plain ruby. I don’t know how internationalization is dealt with in regular ruby. Can someone throw some light on this? Anti Aging

  13. Lisa said February 8th, 2011 at 10:43 AM  

    Yes thanks that was a great read. I’ve been thinking about this recently myself. It’s interesting that I happened to read this today.

    I also saw a ruby post on this learning site which I thought was interesting.

  14. Fleet said February 19th, 2011 at 06:59 AM  

    Excellent content there Sven, you make it all sound so easy ha ha. Keep up the great work friend.:)

  15. cat owner forums said February 20th, 2011 at 08:30 PM  

    First of all, there still won’t be a fullblown one-fits-all I18n/L10n solution in Rails. Please, understand that. Rails still won’t be able to translate your application to your language as long it’s not very similar to US English.

  16. ddsgd said March 21st, 2011 at 06:29 AM  

    How to Convert AVCHD films to AVI

    URL?http://www.wondershare.com/avchd/convert-avchd-to-avi.html Troubles we may possibly have encountered to take satisfaction in and reveal AVCHD films with friends:

    1. You have shot lots of films utilizing AVCHD camcorder, and you also need to upload these films to internet that consist of Youtube to reveal with friends, but you can’t determine the right way to create it.
    2. you could possibly also uncover which you would not possess the ability to available your AVCHD camcorder films on house windows film maker or advertising player.

    That’s true, the AVCHD structure is not accepted by lots of players, and also this kind of structure cannot be uploaded to internet which prevents film sharing. I’ve searched near to some great offer and uncover an simplest alternative finally. The simplest way can be to convert avchd to avi or other standard formats.

    The alternative we are able to consider to solve them: An AVCHD to AVI Converter is needed. Please click to obtain avchd to avi converter, set up and run it. Step one Get AVCHD films from AVCHD Camcorder to PC

    Connect the AVCHD Camcorder for the PC using a USB cable. when attached and powered on, the camcorder should seek out the desktop like a brand brand new disk. It is desirable which you duplicate the films for the PC’s hard-drive earlier to converting avchd to avi or editing it. Step 2. fill AVCHD camcorder videos

    Click “Add Video” or just drag & squirrel away your AVCHD camcorder films using the document checklist directly, you can very easily include AVCHD camcorder videos.

    Load AVCHD camcorder videos Step 3. find AVI as output format

    Select AVI as output structure away from your categorized output formats checklist in “Profile” drop-down checklist and specify the output list to preserve your converted records in “Output” drop-down list.

    Select Convert AVCHD films to AVI output format Step 4. start to convert avchd to avi

    After every little thing is done, strike “Start” key to convert avchd to avi. And all the things can be achieved at quickly demand and higher quality. The conversion demand often is dependent for the genuine film sizing as well as your PC configuration. as well as the output best quality is great.

    After converting avchd to avi, now you can upload these AVI films to internet or view them with house windows advertising Player/Movie Maker to reveal them jointly with your friends. The complete method is easy, and you also can possess a try of the AVCHD to AVI Converter to how to convert avchd to avi and reveal your delighted instant easily.

    Tips: Why we choose AVI format? As we realize that AVI structure is among the probably the most standard formats, that is broadly accepted by the majority of players. as well as the best quality of AVI film is great. using the sake of reputation and compatibility, AVI is regarded as probably the most advantageous choice. Therefore, you only should convert AVCHD to AVI, after which you can very easily reveal your AVCHD camcorder videos.

  17. Cams said March 30th, 2011 at 07:31 PM  

    I made another update to the 18 with the 2.4 plugin that just came out.

  18. jamesk said April 2nd, 2011 at 07:59 AM  

    Wow! Thank you! I continuously wanted to write on my blog something like that. Can I implement a fragment of your post to my blog? amana air conditioning | lamborghini prices | furnace prices

  19. Dvd2Arab said April 5th, 2011 at 03:29 AM  

    i fialed to get latest version plz can yo send me link plz ? ????? ?????

  20. medisoft medical billing  said April 6th, 2011 at 07:27 AM  

    Excellent post.I want to thank you for this informative read, I really appreciate sharing this great post. Keep up your work…

  21. Coffee said April 7th, 2011 at 09:09 PM  

    Just want to say your article is striking.Well with your permission allow me to grab feed to keep up to date with forthcoming post.Thanks a million and please keep up the effective work

  22. thedenver said April 7th, 2011 at 09:26 PM  

    dear post author i want to say congrats on your work for this post have unique information. Even i must say the post is rocking. Last year was really full exciting year for Ruby and Rails and RailsWayCon will be back again in 2011.

  23. mattresses said April 8th, 2011 at 03:54 PM  

    Congratulations!! for the rails to be international. I have used this facility before, this was first appeared in Rails 2.1, but it’s much more flexible and robust in Rails 2.2, handling complicated dependencies between gems.

  24. vibration exercise machines said April 11th, 2011 at 11:35 AM  

    Im not going to say what everyone else has already said, but I do want to comment on your knowledge of the topic.  Youre truly well-informed.

  25. vijaysbhagat said April 11th, 2011 at 11:48 AM  

    Oh my goodness! an amazing article dude. Thank you However I am experiencing issue with ur rss . Don’t elchim hair dryer spybubble review Pentax Optio W60 solano hair dryer know why Unable to subscribe to it. Is there anyone getting identical rss problem? Anyone who knows kindly respond. Thx from

  26. bracelet said April 11th, 2011 at 11:06 PM  

    Its very awesome article,all the content is so beneficial and valuable for us.presentation of article is very good,so I will bookmark it for sharing it with my friends.Thanks for sharing nice and pretty post. echantillon gratuit

  27. tripp pants said April 12th, 2011 at 07:27 PM  

    I loved the article, it was very informing. Keep up the great work.

    tripp pants

  28. SteelJewelry said April 14th, 2011 at 10:47 AM  

  29. beads
  30. http://mods.phpfox.com/demo/blog/view/id11485/titlea-fun-fundraiser-that-kids-lov/
  31. http://www.baby-network.net/blog/view/id9266/titlecreativity-versus-boredom-part/
  32. http://www.blog.resell-rights-depot.com/blog.php?user=LuxuryHandbags&note=22780
  33. http://www.fishaholics.co.uk/blog/view/id18550/titleSyma-S107-Modifications-To-Go/
  34. http://churchbook.us/blog.php?user=replicaclothing&blogentry_id=28165
  35. http://www.biketo.com/wiki/index.php?doc-view-3292
  36. http://philfriendsters.com/blog/view/id26644/titleHow-To-Get-Your-Kids-To-Organi/
  37. http://steeljewelry.insanejournal.com/4984.html
  38. http://www.yourteensite.com/blog/view/id_6278/
  39. http://www.myjeepsite.com/blog/view/id_850/
  40. http://www.watches-trusty-time.com/blog/The-world-of-fashion-explained.html
  41. güzellik said April 14th, 2011 at 10:44 PM  

    I’ve surfed the net more than three hours today, however, I haven’t found such useful information. Thanks a lot, it is really useful to me

  42. fye coupons said April 17th, 2011 at 07:58 PM  

    I enjoyed reading it. I need to read more on this topic…I admiring time and effort you put in your blog hot topic coupons

  43. Best Chef Knife said April 17th, 2011 at 11:38 PM  

    I’ve surfed the net more than three hours today, however, I haven’t found such useful information. Thanks a lot, it is really useful to me

    best chef knife

  44. Allie said April 19th, 2011 at 10:07 AM  

    This is pretty cool. Please post more like this :)

    Surf Camp around the world will be happy about this.

  45. Robet S said April 21st, 2011 at 06:57 AM  

    I having keeping a track of the project. It is so interesting. Please keep us informed as soon as new development occurs.

    Thanks for the post

    forex

  46. Frederik said April 21st, 2011 at 10:16 AM  

    Hi

    thanks for your comment on my site and keep up the good work.

    greeets

  47. side sleeper pillow said April 22nd, 2011 at 07:06 AM  

    Nicely written article, Knowledgeable and informative post. I’m really glad I came my way along your site. Keep posting, I really like the whole topic. Thanks for sharing.

  48. vivie said April 26th, 2011 at 10:32 AM  

    I liked the article on your blog because you are writing useful and others are also good natural cleansing diet | school spirit ideas

  49. Weight Loss said April 26th, 2011 at 03:23 PM  

    Excellent post.I want to thank you for this informative read, I really appreciate sharing this great post. Keep up your work… Weight Loss

  50. indrie said April 28th, 2011 at 05:00 AM  

    I really enjoy reading the articles on this blog.

    iklan

  51. larsen said May 7th, 2011 at 10:33 AM  

    good one thanks to the author

    room reservation software web based intranet

  52. marshall said May 7th, 2011 at 11:05 AM  

    this is really interesting and organized

    sharepoint support services

  53. Englisch Übersetzungen said May 10th, 2011 at 01:52 PM  

    Very interesting and useful. Thanks.

  54. haibo said May 10th, 2011 at 05:20 PM  

    Guys, thanks for the excellent work!

  55. ????? ?????? said May 10th, 2011 at 11:29 PM  

    I Liiike good job

  56. Okey Oyunu said May 12th, 2011 at 03:36 PM  

    Tüm dünya artik okey oyunu oynuyor. Yillardir bir çok oyun programi olmasina ragmen, içlerinden en güzeli olarak nitelendirebilecegimiz tek bir site göze çarpmaktadir. Diger tüm okey oyunu programlarinin aksine ücretsiz olmasi ve 3 boyutlu olarak hizmet vermesi mükemmel bir gelismedir. Sizlerde www. okey-oyunu.com adresinden bu essiz okey oyununu indirebilirsiniz. Kullanimi çok basit ve Türkçe dil seçenegi ile kolaylikla oyuna baslayabilirsiniz. Ister kendi ülkenizden, isterseniz dünyanin tüm farkli bölgelerinden dilediginiz oyun odalarini seçerek, oyuna hemen baslayabilirsiniz. Okey oyunu oynamak için artik arkadas bile aramaniza gerek kalmadan, bilgisayarinizdan 100 binlerce üye ile online olarak okey oyununu oynamanin zevkine varabilirsiniz.

  57. mark said May 12th, 2011 at 09:08 PM  

    This is truly interesting. Thanks so much!

  58. doggie door pointing said May 19th, 2011 at 05:45 AM  

    It can be annoying to keep letting your dog in and out your door. Instead of feeling annoyed, you can look into doggy doors and see which model is suitable for your home and your pet. You don’t have to get lost in the web-wide world, this article serves as your brief guide to dog doors.

  59. Marisa said May 19th, 2011 at 08:19 AM  

    Very informative informations here my friend. Thanks for sharing these cool and useful informations.

    Wish you a nice shining day.

  60. frauen telefonsex said May 19th, 2011 at 10:49 PM  

    hi

    really nice site my friend

    greets

  61. aircard plans said May 20th, 2011 at 07:33 AM  

    AVI is regarded as probably the most advantageous choice.

  62. aircard plans said May 20th, 2011 at 07:33 AM  

    AVI is regarded as probably the most advantageous choice.

  63. dissertation said May 20th, 2011 at 02:12 PM  

    Thanks for giving us objective information, much appreciate this!

  64. p said May 21st, 2011 at 05:06 PM  







    chaussures nike lunarhaze+ white black red [cn3340] - €49.99 : nike tn,requin tn,tn nike,tn requin,nike requin,basket tn,chaussures tn
    nike tn,requin tn,tn nike,tn requin,nike bw,basket tn,chaussures tn : nike free 3.0 3 - Kvinner sko Menn sk
    Nous avons une satisfaction garantie à 100%. Si vous n’êtes pas satisfait avec votre produit dans les 365 jours suivant la réception vous pouvez l’envoyer de nouveau à nous pour un remboursement complet.

    Il est 24 heures période de traitement une fois le paiement re?u. Une fois que les chaussures sont expédiée, vous recevrez un email de notre part avec numéro de suivi afin que vous mai suivre votre commande. Vous aurez vos produits dans 3-5 jours d’affaires (sans compter les week-ends ou jours fériés). La plupart des commandes sont traitées et re?ues par les clients dans les 3 jours.



  65. porno said May 22nd, 2011 at 01:02 PM  

    I do agree with all of the ideas you have presented in your post. They’re really convincing and will definitely work. Still, the posts are too short for newbies. Could you please extend them a bit from next time? Thanks for the post.

  66. porno said May 23rd, 2011 at 10:41 AM  

    good comment. thanks you friends.

    I’ve surfed the net more than three hours today, however, I haven’t found such useful information. Thanks a lot, it is really useful to me

Sorry, comments are closed for this article.

artweb design
Sven Fuchs
Grünberger Str. 65
10245 Berlin, Germany


http://www.artweb-design.de

Fon +49 (30) 47 98 69 96
Fax +49 (30) 47 98 69 97