From 94bfe038dab358e44627f82b62c06f0b597eca73 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 25 Nov 2013 12:01:55 +0530 Subject: [PATCH] Avoid unnecessary traceback when loading plugins that dont have translations for the current UI language --- src/calibre/customize/zipplugin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/customize/zipplugin.py b/src/calibre/customize/zipplugin.py index 044347b613..f32d0290f4 100644 --- a/src/calibre/customize/zipplugin.py +++ b/src/calibre/customize/zipplugin.py @@ -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