mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-14 13:34:21 +00:00
[Lang] Add fallback dll for Windows libintl
This commit is contained in:
parent
bde13515e6
commit
4313974f07
@ -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'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user