summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2022-09-09 16:40:10 +0800
committerPeng Wu <alexepico@gmail.com>2022-09-09 16:42:46 +0800
commitac6681b860583fafeb8e4593aac97f93328bd882 (patch)
tree07a03ac0f4ea9f5de33b91b7e9a8637b1fc7aad6
parent2cc7ad11be7c60aac27ca05d297a56144714331a (diff)
downloadibus-libpinyin-ac6681b860583fafeb8e4593aac97f93328bd882.tar.gz
Fix gettext usage
-rw-r--r--setup/main2.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/setup/main2.py b/setup/main2.py
index 118bd3b..5dacad6 100644
--- a/setup/main2.py
+++ b/setup/main2.py
@@ -60,8 +60,13 @@ try:
except AttributeError:
pass
-gettext.bindtextdomain(DOMAINNAME, localedir)
-gettext.bind_textdomain_codeset(DOMAINNAME, 'UTF-8')
+# Python's gettext module doesn't provide all methods in
+# new Python version
+try:
+ gettext.bindtextdomain(DOMAINNAME, localedir)
+ gettext.bind_textdomain_codeset(DOMAINNAME, 'UTF-8')
+except AttributeError:
+ pass
gettext.install(DOMAINNAME, localedir)