From 76d26d89220f5740103a16bf71df2ae255c00da4 Mon Sep 17 00:00:00 2001 From: Michal Čihař Date: Tue, 30 Dec 2014 15:41:31 +0100 Subject: Fixed #24063 -- Allowed locale variants supported by gettext. The locale code can contain a variant after @, so allowed that. --- django/utils/translation/trans_real.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'django/utils') 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) -- cgit v1.3