Avoid unnecessary traceback when loading plugins that dont have translations for the current UI language

This commit is contained in:
Kovid Goyal 2013-11-25 12:01:55 +05:30
parent dd7e53dece
commit 94bfe038da

View File

@ -94,7 +94,11 @@ def load_translations(namespace, zfp):
if not lang or lang == 'en': # performance optimization
_translations_cache[zfp] = None
return
mo = get_resources(zfp, 'translations/%s.mo' % lang)
with zipfile.ZipFile(zfp) as zf:
try:
mo = zf.read('translations/%s.mo' % lang)
except KeyError:
mo = None # No translations for this language present
if mo is None:
_translations_cache[zfp] = None
return