From e9889347f1a1bd4f98db60e09709f9b1f8cd5598 Mon Sep 17 00:00:00 2001 From: znwu Date: Mon, 8 May 2023 02:20:03 -0700 Subject: [PATCH] Address reviews --- setup/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup/main.py b/setup/main.py index 8ded4d3..3f153a5 100644 --- a/setup/main.py +++ b/setup/main.py @@ -45,6 +45,12 @@ def __init__(self, engine): locale.setlocale(locale.LC_ALL, "") localedir = os.getenv("IBUS_LOCALEDIR") gettext.bindtextdomain("ibus-pinyin", localedir) + # 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()