Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Use :en as a default locale instead of :"en-US" for shipped locale data

#1391

I stumble across this bit every time I start porting or implementing "real" stuff to work with Rails I18n / Rails 2.2RC.

For Rails we've picked the default locale :"en-US" because we've thought it's be the most defensive claim to make. Nobody could really argue for picking anything else because this is in fact the locale to which Rails always (implicitely) was localized.

But I believe this choice isn't really in line with the principle of "doing the simplest thing that ever could work" for Rails that we'd sticked to otherwise.

It doesn't work well in two obvious and common scenarios:

  1. One only wants to localize an app to some simple locales like en, fr, es, de, doesn't care about differences in countries (like en-US vs en-GB) and wants to expose the locale in the URL (like en/:controller/:action). Then one has to map en to en-US for no other reason than to make I18n find the shipped Rails data.

  2. One wants to use a locale fallback mechanism (like in [1]) that makes I18n lookup data from en when requested data is not available in en-US. Then one has to map a specific fallback for every English locale (en-GB, en-AU, ...) to en-US so that I18n would look up en-US when data is not available in the requested locale (say en-GB) - again for no other reason than that Rails ships its default data like this.

So my feeling is our original choice was spoiled by too much discussion about fallbacks and other rather political issues and that picking :en as the default locale for Rails would be the far better choice instead.

So, can we change the Rails default locale from :"en-US" to just :en as long as it is still possible?

I've raised the same issue on the rails-i18n mailinglist [2] and people either wholeheartly agree or side-track to other solutions that rather would not belong to Rails core. ;)

[1] http://github.com/joshmh/globali... + http://github.com/joshmh/globali... [2] http://groups.google.com/group/r...

Reported by Sven Fuchs · November 17th, 2008 @ 01:29 PM

State: committed
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Jeremy Kemper
    Jeremy Kemper
    • State changed from new to open
    • Milestone cleared.

    I think so. Do you have a patch or should I pull from your fork?

    November 17th, 2008 @ 11:34 PM

  2. Sven Fuchs
    Sven Fuchs

    Not yet, wanted to hear your opinions before doing a patch for 2.2. I can post one tomorrow.

    November 17th, 2008 @ 11:38 PM

  3. Sven Fuchs
    Sven Fuchs

    Jeremy, here's a patch. It applies to both rails/master and v2.2.1

    On both branches there are some (I think) unrelated tests failing: test_dependence_with_transaction_support_on_failure and some gem loading related tests

    November 18th, 2008 @ 09:09 AM

  4. Sven Fuchs
    Sven Fuchs

    Oh, ... and I haven't renamed "en-US" to "en" in atom_feed_helper.rb line 113 (and 49) because it's not clear to me if this should change as well?

    November 18th, 2008 @ 09:11 AM

  5. Jeremy Kemper
    Jeremy Kemper
    • State changed from open to committed

    12118963acacc9c869bdd41ef8480a1a4e06d358

    November 18th, 2008 @ 08:08 PM