Commit eafafccf authored by Michal Čihař's avatar Michal Čihař

Fixed handling aliases of locale variants

parent f82624f1
......@@ -131,7 +131,12 @@ class LanguageManager(models.Manager):
# Try "corrected" code
if country is not None:
newcode = '%s_%s' % (lang.lower(), country.upper())
if '@' in country:
region, variant = country.split('@', 1)
country = '%s@%s' % (region.upper(), variant.lower())
else:
country = country.upper()
newcode = '%s_%s' % (lang.lower(), country)
else:
newcode = lang.lower()
try:
......
......@@ -33,6 +33,8 @@ class LanguagesTest(TestCase):
('de-DE', 'de', 'ltr'),
('de_AT', 'de_AT', 'ltr'),
('pt-rBR', 'pt_BR', 'ltr'),
('sr_RS@latin', 'sr_RS@latin', 'ltr'),
('sr-RS@latin', 'sr_RS@latin', 'ltr'),
('ar', 'ar', 'rtl'),
('ar_AA', 'ar', 'rtl'),
('ar_XX', 'ar_XX', 'rtl'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment