380 lines
12 KiB
Diff
380 lines
12 KiB
Diff
From 05a10950d635602fb3fcf4ed0021aa0b15dbd698 Mon Sep 17 00:00:00 2001
|
|
From: fujiwarat <takao.fujiwara1@gmail.com>
|
|
Date: Thu, 9 May 2019 15:49:09 +0900
|
|
Subject: [PATCH] src: Make ISO 639 language names with title
|
|
|
|
Danish translations are small in iso-codes-iso-639-2-da.po for the
|
|
genral usage but the users ask the title format on UI.
|
|
Now ibus_get_language_name() and ibus_get_untranslated_language_name()
|
|
return the dynamic allocation instead of the static characters
|
|
to make the capital character.
|
|
|
|
BUG=https://github.com/ibus/ibus/issues/2079
|
|
---
|
|
src/ibusutil.c | 63 ++++++++++++++++++++++++++++++++++++++++++--------
|
|
src/ibusutil.h | 8 +++----
|
|
2 files changed, 58 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/src/ibusutil.c b/src/ibusutil.c
|
|
index fd1da006..9d003e2e 100644
|
|
--- a/src/ibusutil.c
|
|
+++ b/src/ibusutil.c
|
|
@@ -2,7 +2,7 @@
|
|
/* vim:set et sts=4: */
|
|
/* bus - The Input Bus
|
|
* Copyright (C) 2008-2015 Peng Huang <shawn.p.huang@gmail.com>
|
|
- * Copyright (C) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
|
|
+ * Copyright (C) 2010-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
|
|
* Copyright (C) 2008-2016 Red Hat, Inc.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
@@ -125,8 +125,8 @@ _load_lang()
|
|
ibus_xml_free (node);
|
|
}
|
|
|
|
-const gchar *
|
|
-ibus_get_untranslated_language_name (const gchar *_locale)
|
|
+const static gchar *
|
|
+ibus_get_untranslated_raw_language_name (const gchar *_locale)
|
|
{
|
|
const gchar *retval;
|
|
gchar *p = NULL;
|
|
@@ -148,19 +148,64 @@ ibus_get_untranslated_language_name (const gchar *_locale)
|
|
return "Other";
|
|
}
|
|
|
|
-const gchar *
|
|
+static char *
|
|
+get_first_item_in_semicolon_list (const char *list)
|
|
+{
|
|
+ char **items;
|
|
+ char *item;
|
|
+
|
|
+ items = g_strsplit (list, "; ", 2);
|
|
+
|
|
+ item = g_strdup (items[0]);
|
|
+ g_strfreev (items);
|
|
+
|
|
+ return item;
|
|
+}
|
|
+
|
|
+static char *
|
|
+capitalize_utf8_string (const char *str)
|
|
+{
|
|
+ char first[8] = { 0 };
|
|
+
|
|
+ if (!str)
|
|
+ return NULL;
|
|
+
|
|
+ g_unichar_to_utf8 (g_unichar_totitle (g_utf8_get_char (str)), first);
|
|
+
|
|
+ return g_strconcat (first, g_utf8_offset_to_pointer (str, 1), NULL);
|
|
+}
|
|
+
|
|
+gchar *
|
|
+ibus_get_untranslated_language_name (const gchar *_locale)
|
|
+{
|
|
+ const gchar *raw = ibus_get_untranslated_raw_language_name (_locale);
|
|
+ gchar *tmp = get_first_item_in_semicolon_list (raw);
|
|
+ gchar *retval = capitalize_utf8_string (tmp);
|
|
+ g_free (tmp);
|
|
+ return retval;
|
|
+}
|
|
+
|
|
+gchar *
|
|
ibus_get_language_name (const gchar *_locale)
|
|
{
|
|
- const gchar *retval = ibus_get_untranslated_language_name (_locale);
|
|
+ const gchar *raw = ibus_get_untranslated_raw_language_name (_locale);
|
|
+ const gchar *translation = NULL;
|
|
+ gchar *tmp;
|
|
+ gchar *retval;
|
|
|
|
#ifdef ENABLE_NLS
|
|
- if (g_strcmp0 (retval, "Other") == 0)
|
|
- return dgettext (GETTEXT_PACKAGE, N_("Other"));
|
|
+ if (g_strcmp0 (raw, "Other") == 0)
|
|
+ return g_strdup (dgettext (GETTEXT_PACKAGE, N_("Other")));
|
|
else
|
|
- return dgettext ("iso_639-3", retval);
|
|
+ translation = dgettext ("iso_639-3", raw);
|
|
#else
|
|
- return retval;
|
|
+ translation = raw;
|
|
#endif
|
|
+
|
|
+ tmp = get_first_item_in_semicolon_list (translation);
|
|
+ retval = capitalize_utf8_string (tmp);
|
|
+ g_free (tmp);
|
|
+ return retval;
|
|
}
|
|
|
|
void
|
|
diff --git a/src/ibusutil.h b/src/ibusutil.h
|
|
index 226dd7a8..795365f6 100644
|
|
--- a/src/ibusutil.h
|
|
+++ b/src/ibusutil.h
|
|
@@ -2,8 +2,8 @@
|
|
/* vim:set et sts=4: */
|
|
/* bus - The Input Bus
|
|
* Copyright (C) 2008-2015 Peng Huang <shawn.p.huang@gmail.com>
|
|
- * Copyright (C) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
|
|
- * Copyright (C) 2008-2016 Red Hat, Inc.
|
|
+ * Copyright (C) 2010-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
|
|
+ * Copyright (C) 2008-2018 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
|
|
@@ -42,7 +42,7 @@
|
|
*
|
|
* Returns: untranslated language name
|
|
*/
|
|
-const gchar * ibus_get_untranslated_language_name
|
|
+gchar * ibus_get_untranslated_language_name
|
|
(const gchar *_locale);
|
|
|
|
/**
|
|
@@ -51,6 +51,6 @@ const gchar * ibus_get_untranslated_language_name
|
|
*
|
|
* Returns: translated language name
|
|
*/
|
|
-const gchar * ibus_get_language_name (const gchar *_locale);
|
|
+gchar * ibus_get_language_name (const gchar *_locale);
|
|
|
|
#endif
|
|
--
|
|
2.20.1
|
|
|
|
From 1cb5032e85d85f496e349236d1b74f17fb8db966 Mon Sep 17 00:00:00 2001
|
|
From: fujiwarat <takao.fujiwara1@gmail.com>
|
|
Date: Tue, 23 Apr 2019 15:40:45 +0900
|
|
Subject: [PATCH] configure: Move ibus-setup from configure.ac to Makefile.am
|
|
|
|
@localedir@ can be extracted to ${datarootdir}/locale and
|
|
it needs datarootdir=/usr/share in case configure.ac is used
|
|
and deleting the datarootdir line caused a regression.
|
|
All variables can be extracted in Makefile.am with sed.
|
|
---
|
|
configure.ac | 1 -
|
|
setup/Makefile.am | 13 +++++++++++--
|
|
2 files changed, 11 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 9518e808..7503f3e8 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -724,7 +724,6 @@ ibus/interface/Makefile
|
|
ui/Makefile
|
|
ui/gtk3/Makefile
|
|
setup/Makefile
|
|
-setup/ibus-setup
|
|
bindings/Makefile
|
|
bindings/pygobject/Makefile
|
|
bindings/vala/Makefile
|
|
diff --git a/setup/Makefile.am b/setup/Makefile.am
|
|
index cb4dd8d1..34c8f136 100644
|
|
--- a/setup/Makefile.am
|
|
+++ b/setup/Makefile.am
|
|
@@ -3,8 +3,8 @@
|
|
# ibus - The Input Bus
|
|
#
|
|
# Copyright (c) 2007-2014 Peng Huang <shawn.p.huang@gmail.com>
|
|
-# Copyright (c) 2015-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
|
|
-# Copyright (c) 2007-2018 Red Hat, Inc.
|
|
+# Copyright (c) 2015-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
|
|
+# Copyright (c) 2007-2019 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
|
|
@@ -40,6 +40,15 @@ ibussetup_DATA = \
|
|
bin_SCRIPTS = ibus-setup
|
|
ibussetupdir = $(pkgdatadir)/setup
|
|
|
|
+ibus-setup: ibus-setup.in
|
|
+ $(AM_V_GEN) sed -e "s|\@datarootdir\@|$(datarootdir)|g" \
|
|
+ -e "s|\@localedir\@|$(localedir)|g" \
|
|
+ -e "s|\@libexecdir\@|$(libexecdir)|g" \
|
|
+ -e "s|\@prefix\@|$(prefix)|g" \
|
|
+ -e "s|\@PYTHON\@|$(PYTHON)|g" \
|
|
+ $< > $@.tmp && \
|
|
+ mv $@.tmp $@
|
|
+
|
|
desktop_notrans_files = ibus-setup.desktop
|
|
desktop_DATA = org.freedesktop.IBus.Setup.desktop
|
|
desktopdir = $(datadir)/applications
|
|
--
|
|
2.20.1
|
|
|
|
From 1c54fea645b2ec3a385d492e4ca30a70dbb87c3a Mon Sep 17 00:00:00 2001
|
|
From: fujiwarat <takao.fujiwara1@gmail.com>
|
|
Date: Tue, 23 Apr 2019 18:44:45 +0900
|
|
Subject: [PATCH] data/its: Add ibus.its for IME's component files
|
|
|
|
IBusEngineDesc has translatable strings in longname and
|
|
description tags and they needs to be extracted by xgettext.
|
|
|
|
After you install the ibus.[its|loc] to /usr/share/gettext/its,
|
|
each engine's component file needs to renamed with
|
|
'.inputMethod.xml' in the source directory suffix. E.g.
|
|
Rename 'anthy.xml' to 'anthy.inputMethod.xml' and write the file
|
|
path to the engine's POTFILES.in
|
|
---
|
|
configure.ac | 1 +
|
|
data/Makefile.am | 3 ++-
|
|
data/its/Makefile.am | 29 +++++++++++++++++++++++++++++
|
|
data/its/ibus.its | 14 ++++++++++++++
|
|
data/its/ibus.loc | 7 +++++++
|
|
5 files changed, 53 insertions(+), 1 deletion(-)
|
|
create mode 100644 data/its/Makefile.am
|
|
create mode 100644 data/its/ibus.its
|
|
create mode 100644 data/its/ibus.loc
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 7503f3e8..b5a87b56 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -711,6 +711,7 @@ util/IMdkit/Makefile
|
|
data/Makefile
|
|
data/annotations/Makefile
|
|
data/icons/Makefile
|
|
+data/its/Makefile
|
|
data/keymaps/Makefile
|
|
data/dconf/Makefile
|
|
docs/Makefile
|
|
diff --git a/data/Makefile.am b/data/Makefile.am
|
|
index 2533f444..aa3ee466 100644
|
|
--- a/data/Makefile.am
|
|
+++ b/data/Makefile.am
|
|
@@ -3,7 +3,7 @@
|
|
# ibus - The Input Bus
|
|
#
|
|
# Copyright (c) 2007-2016 Peng Huang <shawn.p.huang@gmail.com>
|
|
-# Copyright (c) 2007-2018 Red Hat, Inc.
|
|
+# Copyright (c) 2007-2019 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,6 +23,7 @@
|
|
SUBDIRS = \
|
|
annotations \
|
|
icons \
|
|
+ its \
|
|
keymaps \
|
|
$(NULL)
|
|
|
|
diff --git a/data/its/Makefile.am b/data/its/Makefile.am
|
|
new file mode 100644
|
|
index 00000000..07c8a96d
|
|
--- /dev/null
|
|
+++ b/data/its/Makefile.am
|
|
@@ -0,0 +1,29 @@
|
|
+# vim:set noet ts=4:
|
|
+#
|
|
+# ibus - The Input Bus
|
|
+#
|
|
+# Copyright (c) 2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
|
|
+# Copyright (c) 2019 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
|
|
+# License as published by the Free Software Foundation; either
|
|
+# version 2.1 of the License, or (at your option) any later version.
|
|
+#
|
|
+# This library is distributed in the hope that it will be useful,
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
+# Lesser General Public License for more details.
|
|
+#
|
|
+# You should have received a copy of the GNU Lesser General Public
|
|
+# License along with this library; if not, write to the Free Software
|
|
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
|
+# USA
|
|
+
|
|
+itsdir = $(datadir)/gettext/its
|
|
+its_DATA = \
|
|
+ ibus.its \
|
|
+ ibus.loc \
|
|
+ $(NULL)
|
|
+
|
|
+-include $(top_srcdir)/git.mk
|
|
diff --git a/data/its/ibus.its b/data/its/ibus.its
|
|
new file mode 100644
|
|
index 00000000..30d8d4e2
|
|
--- /dev/null
|
|
+++ b/data/its/ibus.its
|
|
@@ -0,0 +1,14 @@
|
|
+<?xml version="1.0"?>
|
|
+<its:rules xmlns:its="http://www.w3.org/2005/11/its"
|
|
+ version="2.0">
|
|
+ <its:translateRule selector="/component" translate="no"/>
|
|
+ <its:translateRule selector="/engines" translate="no"/>
|
|
+ <its:translateRule selector="//engine" translate="no"/>
|
|
+ <its:translateRule selector="//longname |
|
|
+ //description"
|
|
+ translate="yes"/>
|
|
+ <its:translateRule selector="//longname[@translatable = 'no']"
|
|
+ translate="no"/>
|
|
+ <its:translateRule selector="//description[@translatable = 'no']"
|
|
+ translate="no"/>
|
|
+</its:rules>
|
|
diff --git a/data/its/ibus.loc b/data/its/ibus.loc
|
|
new file mode 100644
|
|
index 00000000..5a73798b
|
|
--- /dev/null
|
|
+++ b/data/its/ibus.loc
|
|
@@ -0,0 +1,7 @@
|
|
+<?xml version="1.0"?>
|
|
+<locatingRules>
|
|
+ <locatingRule name="IBusEngineDesc" pattern="*.inputMethod.xml">
|
|
+ <documentRule localName="engines" target="ibus.its"/>
|
|
+ <documentRule localName="component" target="ibus.its"/>
|
|
+ </locatingRule>
|
|
+</locatingRules>
|
|
--
|
|
2.20.1
|
|
|
|
From cebe7a9553de69943b955ec99285f74961c9ee4e Mon Sep 17 00:00:00 2001
|
|
From: fujiwarat <takao.fujiwara1@gmail.com>
|
|
Date: Thu, 9 May 2019 15:49:21 +0900
|
|
Subject: [PATCH] client/gtk2: Keep preedit cursor_pos and visible in clearing
|
|
preedit text
|
|
|
|
Clear the preedit_string but keep the preedit_cursor_pos and
|
|
preedit_visible because a time lag could happen, firefox commit
|
|
the preedit text before the preedit text is cleared and it cause
|
|
a double commits of the Hangul preedit in firefox if the preedit
|
|
would be located on the URL bar and click on anywhere of firefox
|
|
out of the URL bar.
|
|
---
|
|
client/gtk2/ibusimcontext.c | 12 ++++++++++--
|
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
|
|
index 264a747a..5e3457ba 100644
|
|
--- a/client/gtk2/ibusimcontext.c
|
|
+++ b/client/gtk2/ibusimcontext.c
|
|
@@ -881,10 +881,18 @@ ibus_im_context_clear_preedit_text (IBusIMContext *ibusimcontext)
|
|
ibusimcontext->preedit_mode == IBUS_ENGINE_PREEDIT_COMMIT) {
|
|
preedit_string = g_strdup (ibusimcontext->preedit_string);
|
|
}
|
|
+
|
|
+ /* Clear the preedit_string but keep the preedit_cursor_pos and
|
|
+ * preedit_visible because a time lag could happen, firefox commit
|
|
+ * the preedit text before the preedit text is cleared and it cause
|
|
+ * a double commits of the Hangul preedit in firefox if the preedit
|
|
+ * would be located on the URL bar and click on anywhere of firefox
|
|
+ * out of the URL bar.
|
|
+ */
|
|
_ibus_context_update_preedit_text_cb (ibusimcontext->ibuscontext,
|
|
ibus_text_new_from_string (""),
|
|
- 0,
|
|
- FALSE,
|
|
+ ibusimcontext->preedit_cursor_pos,
|
|
+ ibusimcontext->preedit_visible,
|
|
IBUS_ENGINE_PREEDIT_CLEAR,
|
|
ibusimcontext);
|
|
if (preedit_string) {
|
|
--
|
|
2.20.1
|
|
|