Skip to content

Commit

Permalink
Fix removed python gettext API
Browse files Browse the repository at this point in the history
  • Loading branch information
znjameswu authored and epico committed May 9, 2023
1 parent ffe471c commit e2e10c4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion setup/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ def __init__(self, engine):
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()
Expand Down

0 comments on commit e2e10c4

Please sign in to comment.