summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorznwu <znjameswu@gmail.com>2023-05-07 18:17:11 -0700
committerPeng Wu <alexepico@gmail.com>2023-05-09 18:13:23 +0800
commite2e10c40de58195aeae1148c3d44da4b1a35fecf (patch)
treebf1b5f6c940c63e8e505e9f8fa1fc3e6863fa858
parentffe471c94e951ca0a78f8fd69c60db4a65e1cb95 (diff)
downloadibus-pinyin-e2e10c40de58195aeae1148c3d44da4b1a35fecf.tar.gz
Fix removed python gettext APIHEADmain
-rw-r--r--setup/main.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/setup/main.py b/setup/main.py
index 3c13c4c..3f153a5 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -45,7 +45,12 @@ class PreferencesDialog:
locale.setlocale(locale.LC_ALL, "")
localedir = os.getenv("IBUS_LOCALEDIR")
gettext.bindtextdomain("ibus-pinyin", localedir)
- gettext.bind_textdomain_codeset("ibus-pinyin", "UTF-8")
+ # Python's gettext module doesn't provide all methods in
+ # new Python version since Python 3.10
+ try:
+ gettext.bind_textdomain_codeset("ibus-pinyin", "UTF-8")
+ except AttributeError:
+ pass
self.__bus = IBus.Bus()
self.__config = self.__bus.get_config()