From 4313974f0737d27ca8a2e92ac2b9e841027d5f4b Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Thu, 10 Nov 2016 10:42:44 +0000 Subject: [PATCH] [Lang] Add fallback dll for Windows libintl --- deluge/ui/util/lang.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/deluge/ui/util/lang.py b/deluge/ui/util/lang.py index f37e5bf4e..0ba76da98 100644 --- a/deluge/ui/util/lang.py +++ b/deluge/ui/util/lang.py @@ -93,7 +93,12 @@ def setup_translations(setup_gettext=True, setup_pygtk=False): if deluge.common.windows_check(): import ctypes - libintl = ctypes.cdll.intl + try: + libintl = ctypes.cdll.intl + except WindowsError: + # Fallback to named dll. + libintl = ctypes.cdll.LoadLibrary('libintl-8.dll') + libintl.bindtextdomain(domain, translations_path.encode(sys.getfilesystemencoding())) libintl.textdomain(domain) libintl.bind_textdomain_codeset(domain, 'UTF-8') @@ -105,8 +110,7 @@ def setup_translations(setup_gettext=True, setup_pygtk=False): gtk.glade.bindtextdomain(domain, translations_path) gtk.glade.textdomain(domain) except Exception as ex: - log.error('Unable to initialize glade translation!') - log.exception(ex) + log.error('Unable to initialize glade translation: %s', ex) if setup_gettext: try: if hasattr(locale, 'bindtextdomain'):