File: Fall-back-to-ibus-anthy-if-ibus-mozc-jp-is-unavailable.patch

package info (click to toggle)
gnome-desktop 44.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,240 kB
  • sloc: ansic: 17,628; sh: 297; xml: 89; makefile: 34
file content (39 lines) | stat: -rw-r--r-- 1,651 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
34
35
36
37
38
39
From: Simon McVittie <smcv@debian.org>
Date: Sun, 5 Mar 2023 12:52:01 +0000
Subject: Fall back to ibus:anthy if ibus:mozc-jp is unavailable

According to discussion on #1029821, mozc only supports little-endian
CPU architectures (for example i386 and arm64) and does not support
big-endian CPU architectures (for example powerpc and s390x), which
is why task-japanese-desktop and task-japanese-gnome-desktop have a
fallback dependency on uim-anthy and ibus-anthy respectively. Reflect
this by falling back to anthy if mozc doesn't appear to be installed.

Bug-Debian: https://bugs.debian.org/1029821
Origin: vendor, Debian
Signed-off-by: Simon McVittie <smcv@debian.org>
Forwarded: no
---
 libgnome-desktop/gnome-languages.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libgnome-desktop/gnome-languages.c b/libgnome-desktop/gnome-languages.c
index 1e91dcb..d4d861f 100644
--- a/libgnome-desktop/gnome-languages.c
+++ b/libgnome-desktop/gnome-languages.c
@@ -1456,6 +1456,15 @@ gnome_get_input_source_from_locale (const char  *locale,
         if (dis) {
                 *type = dis->type;
                 *id = dis->id;
+
+                /* We default to ibus:mozc-jp for Japanese locales, but mozc
+                 * isn't available for all CPU architectures. Fall back to
+                 * ibus:anthy if necessary. */
+                if (g_strcmp0 (*type, "ibus") == 0
+                    && g_strcmp0 (*id, "mozc-jp") == 0
+                    && !g_file_test ("/usr/share/ibus/component/mozc.xml", G_FILE_TEST_EXISTS)) {
+                        *id = "anthy";
+                }
         }
         return dis != NULL;
 }