Commit 1c133831 authored by Michal Čihař's avatar Michal Čihař

Properly generate locale codes for 3 letter region codes

These have to be prefixed with b+.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 326f8ead
......@@ -122,6 +122,9 @@ class LanguageManager(models.Manager):
"""
Language code sanitization.
"""
# Strip b+ prefix from Android
if code.startswith('b+'):
code = code[2:]
code = code.replace(' ', '').replace('(', '').replace(')', '')
while code[-1].isdigit():
code = code[:-1]
......
......@@ -1153,6 +1153,8 @@ class AndroidFormat(FileFormat):
"""
Does any possible formatting needed for language code.
"""
if len(code) == 3:
return 'b+{0}'.format(code)
return code.replace('_', '-r')
......
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