Edgewall Software
Modify

Ticket #84 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years 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 (626 bytes) - added by jarek.zgoda@… 4 years ago.
Fix for proper handling Django LANGUAGE_CODE setting

Change History

Changed 4 years ago by jarek.zgoda@…

Fix for proper handling Django LANGUAGE_CODE setting

comment:1 Changed 4 years ago by cmlenz

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone 1.0 deleted

Patch applied in [366]. Thanks!

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.