call bindtextdomain to resolve i18n issue.
authorPeng Huang <shawn.p.huang@gmail.com>
Thu, 20 Aug 2009 07:39:51 +0000 (15:39 +0800)
committerPeng Huang <shawn.p.huang@gmail.com>
Thu, 20 Aug 2009 07:39:51 +0000 (15:39 +0800)
setup/Makefile.am
setup/ibus-setup.in
setup/main.py

index 122eaad..f80eb7b 100644 (file)
@@ -58,6 +58,7 @@ DISTCLEANFILES = \
 test:
        $(ENV) \
                PYTHONPATH=$(top_srcdir) \
-               IBUS_PREFIX="/usr" \
+               IBUS_PREFIX="@prefix@" \
+               IBUS_LOCALEDIR="@localedir@" \
                $(PYTHON) \
                $(srcdir)/main.py
index 1c05adb..563f936 100644 (file)
@@ -21,7 +21,9 @@
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
+datarootdir=@datarootdir@
 export IBUS_PREFIX=@prefix@
 export IBUS_DATAROOTDIR=@datarootdir@
+export IBUS_LOCALEDIR=@localedir@
 exec python @prefix@/share/ibus/setup/main.py $@
 
index 7b22f1f..cda3ba1 100644 (file)
@@ -19,7 +19,6 @@
 # Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 # Boston, MA  02111-1307  USA
 
-import locale
 import gettext
 import os
 import signal
@@ -69,7 +68,10 @@ class Setup(object):
 
     def __init__(self):
         super(Setup, self).__init__()
-        locale.bind_textdomain_codeset("ibus", "UTF-8")
+        localedir = os.getenv("IBUS_LOCALEDIR")
+        gettext.bindtextdomain("ibus", localedir)
+        glade.bindtextdomain("ibus", localedir)
+        gettext.bind_textdomain_codeset("ibus", "UTF-8")
         glade.textdomain("ibus")
         glade_file = path.join(path.dirname(__file__), "./setup.glade")
         self.__xml = glade.XML(glade_file)