This project is archived and is in readonly mode.
Use :en as a default locale instead of :"en-US" for shipped locale data
Reported by Sven Fuchs | November 17th, 2008 @ 01:29 PM
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:
-
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.
-
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...
Comments and changes to this ticket
-
Jeremy Kemper November 17th, 2008 @ 11:34 PM
- State changed from new to open
- Milestone cleared.
I think so. Do you have a patch or should I pull from your fork?
-
Sven Fuchs November 17th, 2008 @ 11:38 PM
Not yet, wanted to hear your opinions before doing a patch for 2.2. I can post one tomorrow.
-
Sven Fuchs November 18th, 2008 @ 09:09 AM
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
-
Sven Fuchs November 18th, 2008 @ 09:11 AM
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?
-
Jeremy Kemper November 18th, 2008 @ 08:08 PM
- State changed from open to committed
12118963acacc9c869bdd41ef8480a1a4e06d358
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>