[Lang] Add fallback dll for Windows libintl

This commit is contained in:
Calum Lind 2016-11-10 10:42:44 +00:00 committed by Calum Lind
parent bde13515e6
commit 4313974f07

View File

@ -93,7 +93,12 @@ def setup_translations(setup_gettext=True, setup_pygtk=False):
if deluge.common.windows_check(): if deluge.common.windows_check():
import ctypes 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.bindtextdomain(domain, translations_path.encode(sys.getfilesystemencoding()))
libintl.textdomain(domain) libintl.textdomain(domain)
libintl.bind_textdomain_codeset(domain, 'UTF-8') 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.bindtextdomain(domain, translations_path)
gtk.glade.textdomain(domain) gtk.glade.textdomain(domain)
except Exception as ex: except Exception as ex:
log.error('Unable to initialize glade translation!') log.error('Unable to initialize glade translation: %s', ex)
log.exception(ex)
if setup_gettext: if setup_gettext:
try: try:
if hasattr(locale, 'bindtextdomain'): if hasattr(locale, 'bindtextdomain'):