summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2021-11-05 07:22:34 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2021-11-05 07:22:34 +0900
commit28acfd433b3df1673b7c7177915c027ce48c061e (patch)
treec784dde4e247a4e69e599a1df71f6705520728b4
parentacc5570511698c7b5cc037eb81be2c4be52a824f (diff)
downloadibus-28acfd433b3df1673b7c7177915c027ce48c061e.tar.gz
ui/gtk2: Deprecate gettext.bind_textdomain_codeset() since Python 3.8
setup/i18n.py is a symlink of ui/gtk2/i18n.py env PYTHONWARNINGS='d' ibus-setup BUG=https://github.com/ibus/ibus/issues/2276
-rw-r--r--ui/gtk2/i18n.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/gtk2/i18n.py b/ui/gtk2/i18n.py
index 976d1aee..af14efc6 100644
--- a/ui/gtk2/i18n.py
+++ b/ui/gtk2/i18n.py
@@ -3,7 +3,9 @@
# ibus - The Input Bus
#
# Copyright(c) 2007-2015 Peng Huang <shawn.p.huang@gmail.com>
+# Copyright(c) 2012-2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright(c) 2007-2015 Google, Inc.
+# Copyright(c) 2012-2021 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -23,12 +25,14 @@
import locale
import gettext
import os
+import sys
DOMAINNAME = "ibus10"
_ = lambda a: gettext.dgettext(DOMAINNAME, a)
N_ = lambda a: a
+PY3K = sys.version_info >= (3, 0)
LOCALEDIR = os.getenv("IBUS_LOCALEDIR")
def init_textdomain(domainname):
@@ -42,7 +46,9 @@ def init_textdomain(domainname):
except AttributeError:
pass
gettext.bindtextdomain(domainname, LOCALEDIR)
- gettext.bind_textdomain_codeset(domainname, 'UTF-8')
+ # https://docs.python.org/3/library/gettext.html#gettext.lgettext
+ if not PY3K:
+ gettext.bind_textdomain_codeset(domainname, 'UTF-8')
def gettext_engine_longname(engine):
name = engine.get_name()