FINALLY: this fixes translation issues with gtk.Builder on my box (ubuntu 9.10)

svn: r14253
This commit is contained in:
Benny Malengier
2010-02-06 17:17:20 +00:00
parent f7aad51665
commit e752af9ed6
3 changed files with 45 additions and 3 deletions

View File

@@ -28,11 +28,11 @@
#-------------------------------------------------------------------------
import sys
import os
import locale
import const
import signal
import gettext
_ = gettext.gettext
import locale
import logging
LOG = logging.getLogger(".")
@@ -50,6 +50,12 @@ import TransUtils
# Load internationalization setup
#
#-------------------------------------------------------------------------
#the order in which bindtextdomain on gettext and on locale is called
#appears important, so we refrain from doing first all gettext.
#
#TransUtils.setup_gettext()
gettext.bindtextdomain(TransUtils.LOCALEDOMAIN, TransUtils.LOCALEDIR)
try:
locale.setlocale(locale.LC_ALL,'C')
locale.setlocale(locale.LC_ALL,'')
@@ -58,8 +64,18 @@ except locale.Error:
except ValueError:
pass
gettext.textdomain(TransUtils.LOCALEDOMAIN)
gettext.install(TransUtils.LOCALEDOMAIN, localedir=None, unicode=1) #None is sys default locale
try:
locale.bindtextdomain(TransUtils.LOCALEDOMAIN, TransUtils.LOCALEDIR)
#locale.textdomain(TransUtils.LOCALEDOMAIN)
except locale.Error:
print 'No translation in some gtk.Builder strings, '\
'call TransUtils.setup_windows_gtk ??'
LOG.debug('Using locale:', locale.getlocale())
TransUtils.setup_gettext()
#-------------------------------------------------------------------------
#