From 9ca4120cf4a72ca769f3fe57122c73c1bc7f5dd1 Mon Sep 17 00:00:00 2001 From: Peter Landgren Date: Thu, 18 Feb 2010 14:45:35 +0000 Subject: [PATCH] Better support for translation under Windows. svn: r14409 --- src/TransUtils.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/TransUtils.py b/src/TransUtils.py index 5f05d1705..867890426 100644 --- a/src/TransUtils.py +++ b/src/TransUtils.py @@ -84,11 +84,24 @@ def setup_windows_gtk(): This function should be called on windows instead of locale.bindtextdomain """ import ctypes - libintl = ctypes.cdll.intl - libintl.bindtextdomain(LOCALEDOMAIN, str(LOCALEDIR)) + try: + import webkit + # Webkit installed, try to find path to libintl-8.dll + os_path = os.environ['PATH'] + for subpath in os_path.split(';'): + path2file = subpath + '\\libintl-8.dll' + if os.path.isfile(path2file): + break + libintl = ctypes.cdll.LoadLibrary(path2file) + except: + # If WebKit not installed, use this + libintl = ctypes.cdll.intl #LoadLibrary('c:\\WINDOWS\\system\\intl.dll') + # The intl.dll in c:\\Program\\GTK2-Runtime\\bin\\ does not give any Glade translations. + #libintl = ctypes.cdll.LoadLibrary('c:\\Program\\GTK2-Runtime\\bin\\intl.dll') + libintl.bindtextdomain(LOCALEDOMAIN, + LOCALEDIR.encode(sys.getfilesystemencoding())) libintl.textdomain(LOCALEDOMAIN) libintl.bind_textdomain_codeset(LOCALEDOMAIN, "UTF-8") - libintl.gettext.restype = ctypes.c_char_p def get_localedomain(): """