From 27aa99000d3a49ff690694dbb4c3f5cc2eff0767 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 23 Dec 2016 13:23:25 +0800 Subject: fixes localedir option for configure --- setup/main2.py | 3 +++ src/Makefile.am | 1 + src/PYMain.cc | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/setup/main2.py b/setup/main2.py index a7f771f..fe28b7b 100644 --- a/setup/main2.py +++ b/setup/main2.py @@ -47,9 +47,12 @@ import config from dicttreeview import DictionaryTreeView from shortcuteditor import ShortcutEditor +DOMAINNAME = 'ibus-libpinyin' locale.setlocale(locale.LC_ALL, "") localedir = os.getenv("IBUS_LOCALEDIR") pkgdatadir = os.getenv("IBUS_PKGDATADIR") or "." +gettext.bindtextdomain(DOMAINNAME, localedir) +gettext.bind_textdomain_codeset(DOMAINNAME, 'UTF-8') gettext.install('ibus-libpinyin', localedir) class PreferencesDialog: diff --git a/src/Makefile.am b/src/Makefile.am index 087957c..76739d1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -110,6 +110,7 @@ ibus_engine_libpinyin_CXXFLAGS = \ @LIBPINYIN_CFLAGS@ \ @OPENCC_CFLAGS@ \ -DGETTEXT_PACKAGE=\"@GETTEXT_PACKAGE@\" \ + -DLOCALEDIR=\"$(localedir)\" \ -DPKGDATADIR=\"$(pkgdatadir)\" \ -DLIBEXECDIR=\"$(libexecdir)\" \ $(NULL) diff --git a/src/PYMain.cc b/src/PYMain.cc index 3c44fb3..4babc5b 100644 --- a/src/PYMain.cc +++ b/src/PYMain.cc @@ -25,6 +25,7 @@ #include #include #include +#include #include "PYEngine.h" #include "PYPointer.h" #include "PYBus.h" @@ -165,6 +166,10 @@ main (gint argc, gchar **argv) setlocale (LC_ALL, ""); + bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + textdomain(GETTEXT_PACKAGE); + context = g_option_context_new ("- ibus pinyin engine component"); g_option_context_add_main_entries (context, entries, "ibus-libpinyin"); -- cgit