From 852449056cb1d4c6f4fccfdd9a5da6143b6f1e27 Mon Sep 17 00:00:00 2001 From: Choe Hwanjin Date: Sat, 5 Mar 2011 01:06:41 +0900 Subject: [PATCH] Use GETTEXT_PACKAGE in ibus-setup-hangul ibus-setup-hangul use hardcoded string for text domain. But it will be better to use GETTEXT_PACKAGE from configure script. So I add gettext_package variable to config.py and ibus-setup-hangul use it. --- setup/Makefile.am | 3 ++- setup/config.py.in | 1 + setup/main.py | 11 +++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/setup/Makefile.am b/setup/Makefile.am index cc003bb..71f4e46 100644 --- a/setup/Makefile.am +++ b/setup/Makefile.am @@ -55,7 +55,8 @@ test: $(PYTHON) $(srcdir)/main.py config.py: config.py.in Makefile - sed -e 's&@SETUP_LOCALEDIR@&$(localedir)&g' \ + sed -e 's&@SETUP_GETTEXT_PACKAGE@&$(GETTEXT_PACKAGE)&g' \ + -e 's&@SETUP_LOCALEDIR@&$(localedir)&g' \ -e 's&@SETUP_PKGDATADIR@&$(pkgdatadir)&g' \ -e 's&@SETUP_PKGLIBDIR@&$(pkglibdir)&g' $< > $@ diff --git a/setup/config.py.in b/setup/config.py.in index d317fcb..2e90097 100644 --- a/setup/config.py.in +++ b/setup/config.py.in @@ -18,6 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +gettext_package = '@SETUP_GETTEXT_PACKAGE@' localedir = '@SETUP_LOCALEDIR@' pkgdatadir = '@SETUP_PKGDATADIR@' pkglibdir = '@SETUP_PKGLIBDIR@' diff --git a/setup/main.py b/setup/main.py index ba5b0de..8668f9d 100644 --- a/setup/main.py +++ b/setup/main.py @@ -29,20 +29,17 @@ import config import subprocess from keycapturedialog import KeyCaptureDialog -_ = lambda a : gettext.dgettext("ibus-hangul", a) +_ = lambda a : gettext.dgettext(config.gettext_package, a) class Setup (): def __init__ (self): - locale.bindtextdomain("ibus-hangul", config.localedir) - locale.bind_textdomain_codeset("ibus-hangul", "UTF-8") - self.__bus = ibus.Bus() self.__config = self.__bus.get_config() self.__config.connect("value-changed", self.on_value_changed, None) ui_file = os.path.join(os.path.dirname(__file__), "setup.ui") self.__builder = gtk.Builder() - self.__builder.set_translation_domain("ibus-hangul") + self.__builder.set_translation_domain(config.gettext_package) self.__builder.add_from_file(ui_file) # Hangul tab @@ -183,5 +180,7 @@ class Setup (): return self.__config.set_value("engine/Hangul", name, v) if __name__ == "__main__": - gettext.bindtextdomain("ibus-hangul", config.localedir) + locale.bindtextdomain(config.gettext_package, config.localedir) + locale.bind_textdomain_codeset(config.gettext_package, "UTF-8") + Setup().run() -- 2.7.4