Better support for translation under Windows.

svn: r14409
This commit is contained in:
Peter Landgren 2010-02-18 14:45:35 +00:00
parent 18986231a8
commit 9ca4120cf4

View File

@ -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():
"""