Ticket #84 (closed defect: fixed)
BabelDjango passes settings.LANGUAGE_CODE to babel for locale code parsing
| Reported by: | jarek.zgoda@… | Owned by: | cmlenz |
|---|---|---|---|
| Priority: | critical | Milestone: | |
| Component: | General | Version: | devel |
| Keywords: | babeldjango | Cc: |
Description
BabelDjango (templatetags/babel.py) passes value of settings.LANGUAGE_CODE to babel core to get Locale object. This works only when the language code has one element, such as "en", "pl" or "de", but fails on 2-element language codes, like "de-at" or "en-gb". From django documentation (i.e. in http://www.djangoproject.com/documentation/settings/#language-code and http://www.djangoproject.com/documentation/i18n/#how-django-discovers-language-preference), there is explicit statement, that settings.LANGUAGE_CODE is not a locale code, but the code that is eg. sent by the browser as accepted language. In Django itself, in the locale catalog loading machinery, settings.LANGUAGE_CODE is wrapped in a call to django.utils.translation.to_locale().
Attached is patch against current trunk, that wraps settings.LANGUAGE_CODE in similar manner as Django does.
