get_translator() should not raise an exception

This commit is contained in:
Kovid Goyal 2016-06-22 11:23:33 +05:30
parent 0f653b4d99
commit 4854c187f3

View File

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