Dont fail to start up if there are errors in the translation file

This commit is contained in:
Kovid Goyal 2020-12-01 07:36:39 +05:30
parent 18c97430bb
commit bfedab34b8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -240,10 +240,20 @@ def translator_for_lang(lang):
pass # No lcdata
if buf is not None:
t = GNUTranslations(buf)
try:
t = GNUTranslations(buf)
except Exception:
import traceback
traceback.print_exc()
t = None
if iso639 is not None:
iso639 = GNUTranslations(iso639)
t.add_fallback(iso639)
try:
iso639 = GNUTranslations(iso639)
except Exception:
iso639 = None
else:
if t is not None:
t.add_fallback(iso639)
if t is None:
t = NullTranslations()