File: Fix-removed-python-gettext-API.patch

package info (click to toggle)
ibus-pinyin 1.5.0-10
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,532 kB
  • sloc: sh: 11,567; cpp: 6,504; ansic: 792; makefile: 394; python: 306; awk: 13
file content (28 lines) | stat: -rw-r--r-- 1,003 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From: znwu <znjameswu@gmail.com>
Date: Sun, 7 May 2023 18:17:11 -0700
Subject: Fix removed python gettext API

Origin: https://github.com/ibus/ibus-pinyin/commit/e2e10c40
Bug-Debian: https://bugs.debian.org/1036197
---
 setup/main.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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