summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2014-12-30 15:41:31 +0100
committerTim Graham <timograham@gmail.com>2015-04-24 20:31:16 -0400
commit76d26d89220f5740103a16bf71df2ae255c00da4 (patch)
tree04aa358cfebaf5f02dc5b4a2ba19d9725353fc60 /django
parent9d6914da668d9a38537d4c29e3601f06dd830477 (diff)
Fixed #24063 -- Allowed locale variants supported by gettext.
The locale code can contain a variant after @, so allowed that.
Diffstat (limited to 'django')
-rw-r--r--django/utils/translation/trans_real.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index a7a89f9bd5..8a2527022d 100644
--- a/django/utils/translation/trans_real.py
+++ b/django/utils/translation/trans_real.py
@@ -43,9 +43,12 @@ accept_language_re = re.compile(r'''
(?:\s*,\s*|$) # Multiple accepts per header.
''', re.VERBOSE)
-language_code_re = re.compile(r'^[a-z]{1,8}(?:-[a-z0-9]{1,8})*$', re.IGNORECASE)
+language_code_re = re.compile(
+ r'^[a-z]{1,8}(?:-[a-z0-9]{1,8})*(?:@[a-z0-9]{1,20})?$',
+ re.IGNORECASE
+)
-language_code_prefix_re = re.compile(r'^/([\w-]+)(/|$)')
+language_code_prefix_re = re.compile(r'^/([\w@-]+)(/|$)')
@receiver(setting_changed)