Commit 9a7aba99 authored by Michal Čihař's avatar Michal Čihař

Try harder to get base language defintion

For en_CA@foo it would first try en_CA and fallback to en.
parent 1568bdff
......@@ -171,8 +171,21 @@ class LanguageManager(models.Manager):
pluralequation='(n != 1)',
)
# In case this is just a different variant of known language, get
# params from that
# Check for different variant
if '@' in code:
parts = code.split('@')
try:
baselang = Language.objects.get(code=parts[0])
lang.name = baselang.name
lang.nplurals = baselang.nplurals
lang.pluralequation = baselang.pluralequation
lang.direction = baselang.direction
lang.save()
return lang
except Language.DoesNotExist:
pass
# Check for different country
if '_' in code or '-' in code:
parts = code.replace('-', '_').split('_')
try:
......
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