Internationalisation in edge Rails

After the announcement yesterday that Rails 2.2 will have support for internationalisation (i18n) in the core, I read the linked articles and was slightly surprised that rather than unifying/replacing the i18n plugins currently available, it will actually provide an API which makes creating a back-end for handling your locales easier.

I’ve been using Globalite in the Rails project I’m working on and while it’s the best solution I’ve tried, I was always frustrated by the use of YAML for it’s locale files. Thankfully the changes in Rails 2.2 will likely mean a move to pure Ruby locale files, introducing the benefits of namespaces and the ability to override/extend generic files with site-specific ones.

Now we just have to wait a few months for the release and see what plugins adapt/appear to take advantage of it.

Tags: , , , , ,

2 Responses to “Internationalisation in edge Rails”

  1. Thomas Nichols Says:

    We’re using Globalite too, and loving it (apart from occasional weird __localization_missing__ errors). IIUC, though, the rails i18n support isn’t going to change the way the backend works; I’m guessing our existing :hello.l calls will need to change to :hello.t and similar API changes, but that the backend will stay the same.

    It seems “Hello {name}” becomes “Hello {{name}}”, but otherwise it looks as though our existing translated yamls won’t need much tweaking. And if you don’t like yaml, you’ll be able to switch to GeText po/mo files or use Globalize and shove it all in the db. Looks like good news to me.

    – Thomas.

  2. Cameron Says:

    Hi Thomas. Yeah, you might be right about the way Globalite stores it’s translation files in YAML not changing - I guess from an existing-user point of view that’d make sense.

    The reason I mentioned using ruby files (aside from the benefits I mentioned in the post) was that the new ’simple’ back-end that Rails uses to localise to en-US is using ruby files also.

    Probably some as-yet unreleased plugin which functions similar to Globalite will appear and I’ll move to that.

    As you say - good news indeed. :)

Leave a Reply