Edgewall Software

Ticket #84 (closed defect: fixed)

Opened 6 months ago

Last modified 3 months ago

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.

Attachments

babel.py.diff (0.6 kB) - added by jarek.zgoda@… 6 months ago.
Fix for proper handling Django LANGUAGE_CODE setting

Change History

Changed 6 months ago by jarek.zgoda@…

Fix for proper handling Django LANGUAGE_CODE setting

Changed 3 months ago by cmlenz

  • status changed from new to closed
  • resolution set to fixed
  • milestone 1.0 deleted

Patch applied in [366]. Thanks!

Add/Change #84 (BabelDjango passes settings.LANGUAGE_CODE to babel for locale code parsing)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.