From 8f3bb8e840941448c03dbde0c7fa99f3b6f5be4a Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Fri, 11 Dec 2009 15:46:56 +0800 Subject: [PATCH] Use gettext replace locale --- ui/gtk/Makefile.am | 2 ++ ui/gtk/ibus-ui-gtk.in | 7 +++++++ ui/gtk/main.py | 6 ++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ui/gtk/Makefile.am b/ui/gtk/Makefile.am index d51b89e..4aba5f1 100644 --- a/ui/gtk/Makefile.am +++ b/ui/gtk/Makefile.am @@ -64,5 +64,7 @@ gtkpanel.xml: gtkpanel.xml.in test: $(ENV) DBUS_DEBUG=true \ IBUS_PREFIX=@prefix@ \ + IBUS_DATAROOTDIR=@datarootdir@ \ + IBUS_LOCALEDIR=@localedir@ \ PYTHONPATH=$(top_srcdir) \ $(PYTHON) $(srcdir)/main.py diff --git a/ui/gtk/ibus-ui-gtk.in b/ui/gtk/ibus-ui-gtk.in index 8781e4a..2c4460d 100644 --- a/ui/gtk/ibus-ui-gtk.in +++ b/ui/gtk/ibus-ui-gtk.in @@ -19,6 +19,13 @@ # License along with this program; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, # Boston, MA 02111-1307 USA + +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/ui/gtk/main.py $@ diff --git a/ui/gtk/main.py b/ui/gtk/main.py index 50eba52..60c5209 100644 --- a/ui/gtk/main.py +++ b/ui/gtk/main.py @@ -25,7 +25,7 @@ import sys import getopt import ibus import gtk -import locale +import gettext import panel import notifications @@ -77,5 +77,7 @@ def main(): launch_panel() if __name__ == "__main__": - locale.bind_textdomain_codeset("ibus", "UTF-8") + localedir = os.getenv("IBUS_LOCALEDIR") + gettext.bindtextdomain("ibus", localedir) + gettext.bind_textdomain_codeset("ibus", "UTF-8") main() -- 2.7.4