Fix translator for English not being returned on other locales

This commit is contained in:
Kovid Goyal 2019-05-01 14:34:05 +05:30
parent b018850f24
commit d1f94b510c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -155,6 +155,8 @@ def get_translator(bcp_47_code):
lang = {'pt':'pt_BR', 'zh':'zh_CN'}.get(lang, lang)
available = available_translations()
found = True
if lang == 'en':
return found, lang, NullTranslations()
if lang not in available:
lang = {'pt':'pt_BR', 'zh':'zh_CN'}.get(parts[0], parts[0])
if lang not in available:
@ -162,8 +164,6 @@ def get_translator(bcp_47_code):
if lang not in available:
lang = 'en'
found = False
if lang == 'en':
return found, lang, NullTranslations()
return found, lang, get_single_translator(lang)