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()