Supporting different locale regions using Rails i18n

Posted by Olly on Stack Overflow See other posts from Stack Overflow or by Olly
Published on 2010-06-07T23:53:39Z Indexed on 2010/06/08 0:02 UTC
Read the original article Hit count: 389

I'm using the standard Rails I18n API to localise some of our views. This is working really well, but we now have a few use cases for regional changes to the en locale.

The API guide mentions that this isn't supported directly, and other plugins should be used. However, I'm wondering whether there's a simpler way to do this.

I already have en.yml, so in theory I could just create en-AU.yml and en-US.yml which are effectively clones of en.yml but with a few regional changes applied. I could then add additional English - American and English - Australian options to our configuration which would map to the new region-specific locales and allow users to use a region-specific locale.

The only problem I can think of with this is that it isn't DRY -- I would have duplicate translations for all common English words. I can't see a way around this.

Are there any other disadvantages to this approach, or should I just bite the bullet and dive into one of the plug-ins such as Globalize2 instead?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about localization