From 6fdf10812e7cd8dbf0ce82f645a162bd696852c6 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 15 Jul 2019 13:34:13 +0200 Subject: [PATCH 1/5] gnome-languages: Add more modifiers translator comments --- libgnome-desktop/gnome-languages.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libgnome-desktop/gnome-languages.c b/libgnome-desktop/gnome-languages.c index 5929d97b..7d1d5221 100644 --- a/libgnome-desktop/gnome-languages.c +++ b/libgnome-desktop/gnome-languages.c @@ -1375,12 +1375,17 @@ gnome_get_translated_modifier (const char *modifier, and gez_ET locales from gez_ER@abegede respective gez_ET@abegede. The difference is related to collation. */ g_hash_table_insert (modifiers_map, g_strdup ("abegede"), g_strdup (_("Abegede"))); + /* TRANSLATORS: Used to distinguish Cyrillic from Latin written language variants. */ g_hash_table_insert (modifiers_map, g_strdup ("cyrillic"), g_strdup (_("Cyrillic"))); + /* TRANSLATORS: Also known as "Nagari", a written variant for many languages + of the Indian subcontinent. See: + https://en.wikipedia.org/wiki/Devanagari */ g_hash_table_insert (modifiers_map, g_strdup ("devanagari"), g_strdup (_("Devanagari"))); /* TRANSLATORS: Used to distinguish the label representing the tt_RU locale from tt_RU@iqtelif. It's a special alphabet for Tatar. */ g_hash_table_insert (modifiers_map, g_strdup ("iqtelif"), g_strdup (_("IQTElif"))); - /* TRANSLATORS: The alphabet/script, not the language. */ + /* TRANSLATORS: The alphabet/script, not the language. Used to distinguish + Latin from Cyrillic written language variants. */ g_hash_table_insert (modifiers_map, g_strdup ("latin"), g_strdup (_("Latin"))); /* TRANSLATORS: "Saho" is a variant of the Afar language. Used to distinguish the label representing the aa_ER locale from aa_ER@saaho. */ -- GitLab From 2e3c54e249b7cc046287569ade5be7e00bcc2ecb Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 15 Jul 2019 13:39:18 +0200 Subject: [PATCH 2/5] gnome-languages: Link to SUPPORTED list So we don't have to try and guess where the latest version of the file might be. --- libgnome-desktop/gnome-languages.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libgnome-desktop/gnome-languages.c b/libgnome-desktop/gnome-languages.c index 7d1d5221..2ef236be 100644 --- a/libgnome-desktop/gnome-languages.c +++ b/libgnome-desktop/gnome-languages.c @@ -1369,6 +1369,9 @@ gnome_get_translated_modifier (const char *modifier, old_locale = uselocale (loc); } + /* Modifiers as listed in glibc's SUPPORTED file: + * https://sourceware.org/git/?p=glibc.git;a=blob;f=localedata/SUPPORTED;hb=HEAD + * (except for @euro, which would be superfluous in this context). */ modifiers_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); /* TRANSLATORS: Used to distinguish the labels representing the gez_ER @@ -1395,10 +1398,6 @@ gnome_get_translated_modifier (const char *modifier, locale from ca_ES@valencia. */ g_hash_table_insert (modifiers_map, g_strdup ("valencia"), g_strdup (_("Valencia"))); - /* The modifiers above are the ones present in glibc's SUPPORTED file - * (except for @euro, which would be superfluous in this context). - */ - if (g_hash_table_contains (modifiers_map, modifier)) retval = g_strdup (g_hash_table_lookup (modifiers_map, modifier)); else -- GitLab From 147ead1807494a27526507a16b9cb17b6e886f75 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 15 Jul 2019 13:42:44 +0200 Subject: [PATCH 3/5] gnome-languages: Don't duplicate static strings in hash table We copy them out of the hash table before destroying it. --- libgnome-desktop/gnome-languages.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libgnome-desktop/gnome-languages.c b/libgnome-desktop/gnome-languages.c index 2ef236be..38aa391e 100644 --- a/libgnome-desktop/gnome-languages.c +++ b/libgnome-desktop/gnome-languages.c @@ -1372,31 +1372,31 @@ gnome_get_translated_modifier (const char *modifier, /* Modifiers as listed in glibc's SUPPORTED file: * https://sourceware.org/git/?p=glibc.git;a=blob;f=localedata/SUPPORTED;hb=HEAD * (except for @euro, which would be superfluous in this context). */ - modifiers_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + modifiers_map = g_hash_table_new (g_str_hash, g_str_equal); /* TRANSLATORS: Used to distinguish the labels representing the gez_ER and gez_ET locales from gez_ER@abegede respective gez_ET@abegede. The difference is related to collation. */ - g_hash_table_insert (modifiers_map, g_strdup ("abegede"), g_strdup (_("Abegede"))); + g_hash_table_insert (modifiers_map, "abegede", _("Abegede")); /* TRANSLATORS: Used to distinguish Cyrillic from Latin written language variants. */ - g_hash_table_insert (modifiers_map, g_strdup ("cyrillic"), g_strdup (_("Cyrillic"))); + g_hash_table_insert (modifiers_map, "cyrillic", _("Cyrillic")); /* TRANSLATORS: Also known as "Nagari", a written variant for many languages of the Indian subcontinent. See: https://en.wikipedia.org/wiki/Devanagari */ - g_hash_table_insert (modifiers_map, g_strdup ("devanagari"), g_strdup (_("Devanagari"))); + g_hash_table_insert (modifiers_map, "devanagari", _("Devanagari")); /* TRANSLATORS: Used to distinguish the label representing the tt_RU locale from tt_RU@iqtelif. It's a special alphabet for Tatar. */ - g_hash_table_insert (modifiers_map, g_strdup ("iqtelif"), g_strdup (_("IQTElif"))); + g_hash_table_insert (modifiers_map, "iqtelif", _("IQTElif")); /* TRANSLATORS: The alphabet/script, not the language. Used to distinguish Latin from Cyrillic written language variants. */ - g_hash_table_insert (modifiers_map, g_strdup ("latin"), g_strdup (_("Latin"))); + g_hash_table_insert (modifiers_map, "latin", _("Latin")); /* TRANSLATORS: "Saho" is a variant of the Afar language. Used to distinguish the label representing the aa_ER locale from aa_ER@saaho. */ - g_hash_table_insert (modifiers_map, g_strdup ("saaho"), g_strdup (_("Saho"))); + g_hash_table_insert (modifiers_map, "saaho", _("Saho")); /* TRANSLATORS: "Valencia" is a dialect of the Catalan language spoken in Valencia. Used to distinguish the label representing the ca_ES locale from ca_ES@valencia. */ - g_hash_table_insert (modifiers_map, g_strdup ("valencia"), g_strdup (_("Valencia"))); + g_hash_table_insert (modifiers_map, "valencia", _("Valencia")); if (g_hash_table_contains (modifiers_map, modifier)) retval = g_strdup (g_hash_table_lookup (modifiers_map, modifier)); -- GitLab From 6047fbe84eba5c97d27c6cb5b493ad9bb67908b4 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 15 Jul 2019 13:46:45 +0200 Subject: [PATCH 4/5] gnome-languages: Fix build time warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libgnome-desktop/gnome-languages.c: In function ‘get_translated_language’: libgnome-desktop/gnome-languages.c:726:25: warning: ‘old_locale’ may be used uninitialized in this function [-Wmaybe-uninitialized] 726 | uselocale (old_locale); | ^~~~~~~~~~~~~~~~~~~~~~ libgnome-desktop/gnome-languages.c:727:25: warning: ‘loc’ may be used uninitialized in this function [-Wmaybe-uninitialized] 727 | freelocale (loc); | ^~~~~~~~~~~~~~~~ --- libgnome-desktop/gnome-languages.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgnome-desktop/gnome-languages.c b/libgnome-desktop/gnome-languages.c index 38aa391e..f9bb960e 100644 --- a/libgnome-desktop/gnome-languages.c +++ b/libgnome-desktop/gnome-languages.c @@ -703,8 +703,8 @@ get_translated_language (const char *code, name = NULL; if (language != NULL) { const char *translated_name; - locale_t loc; - locale_t old_locale; + locale_t loc = 0; + locale_t old_locale = 0; if (locale != NULL) { loc = newlocale (LC_MESSAGES_MASK, locale, (locale_t) 0); -- GitLab From b84998f57e4bfcf3455e04589a0fdde4ecd1b7e9 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 15 Jul 2019 13:47:46 +0200 Subject: [PATCH 5/5] build: Bump soname for new API gnome_get_translated_modifier() was added --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index bba00d99..39b0e438 100644 --- a/meson.build +++ b/meson.build @@ -11,7 +11,7 @@ project('gnome-desktop', 'c', # * Bump the third component otherwise. # # A lot easier than libtool, right? -libversion = '17.0.7' +libversion = '17.1.7' soversion = libversion.split('.')[0] gdk_pixbuf_req = '>= 2.36.5' -- GitLab