Skip to content

Commit 93358ef

Browse files
author
cmlenz
committed
BabelDjango: fix for template tag library when locale contains more than just the language tag. Closes #84. Thanks to Jarek Zgoda for the patch.
git-svn-id: http://svn.edgewall.org/repos/babel/contrib/django@366 59ecc08e-a131-0410-9ea7-d4c0f28ac310
1 parent 08b6d36 commit 93358ef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

babeldjango/templatetags/babel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from django.conf import settings
1515
from django.template import Library
16+
from django.utils.translation import to_locale
1617
try:
1718
from pytz import timezone
1819
except ImportError:
@@ -29,7 +30,7 @@
2930
def _get_format():
3031
locale = get_current_locale()
3132
if not locale:
32-
locale = Locale.parse(settings.LANGUAGE_CODE)
33+
locale = Locale.parse(to_locale(settings.LANGUAGE_CODE))
3334
if timezone:
3435
tzinfo = timezone(settings.TIME_ZONE)
3536
else:

0 commit comments

Comments
 (0)