summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2017-01-11 10:33:23 +0800
committerPeng Wu <alexepico@gmail.com>2017-01-11 10:33:23 +0800
commit0871fa0eb228af0abee03421f91256a779de4316 (patch)
treea59eeb796dba6734eee98f2161b3344e8006588a
parent3d713493579c1c916684a3e0af6deff75cf22c7d (diff)
downloadibus-libpinyin-0871fa0eb228af0abee03421f91256a779de4316.tar.gz
ibus-libpinyin-0871fa0eb228af0abee03421f91256a779de4316.tar.xz
ibus-libpinyin-0871fa0eb228af0abee03421f91256a779de4316.zip
fixes main2.py
-rw-r--r--setup/main2.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/setup/main2.py b/setup/main2.py
index 7f3c101..a3a550a 100644
--- a/setup/main2.py
+++ b/setup/main2.py
@@ -51,8 +51,18 @@ DOMAINNAME = 'ibus-libpinyin'
locale.setlocale(locale.LC_ALL, "")
localedir = os.getenv("IBUS_LOCALEDIR")
pkgdatadir = os.getenv("IBUS_PKGDATADIR") or "."
+
+# Python's locale module doesn't provide all methods on some
+# operating systems like FreeBSD
+try:
+ locale.bindtextdomain(DOMAINNAME, localedir)
+ locale.bind_textdomain_codeset(DOMAINNAME, 'UTF-8')
+except AttributeError:
+ pass
+
gettext.bindtextdomain(DOMAINNAME, localedir)
gettext.bind_textdomain_codeset(DOMAINNAME, 'UTF-8')
+
gettext.install(DOMAINNAME, localedir)
class PreferencesDialog: