[gspell/wip/icu: 3/5] language: use _gspell_icu_get_language_name_from_code()




commit d481eeff210e6e2549c2d94eeac68099fd12699a
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Oct 6 01:14:58 2020 +0200

    language: use _gspell_icu_get_language_name_from_code()
    
    https://gitlab.gnome.org/GNOME/gspell/-/issues/14

 gspell/gspell-language.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gspell/gspell-language.c b/gspell/gspell-language.c
index f11485e..84bc515 100644
--- a/gspell/gspell-language.c
+++ b/gspell/gspell-language.c
@@ -27,6 +27,7 @@
 #include <string.h>
 #include <glib/gi18n-lib.h>
 #include <enchant.h>
+#include "gspell-icu.h"
 
 #ifdef OS_OSX
 #include "gspell-osx.h"
@@ -65,6 +66,8 @@ spell_language_dict_describe_cb (const gchar * const language_code,
        GList *l;
        GspellLanguage *language;
 
+       g_return_if_fail (language_code != NULL);
+
        for (l = *available_languages; l != NULL; l = l->next)
        {
                GspellLanguage *cur_language = l->data;
@@ -78,8 +81,14 @@ spell_language_dict_describe_cb (const gchar * const language_code,
 
        language = g_slice_new (GspellLanguage);
        language->code = g_strdup (language_code);
-       /* Translators: %s is the language ISO code. */
-       language->name = g_strdup_printf (C_("language", "Unknown (%s)"), language_code);
+
+       language->name = _gspell_icu_get_language_name_from_code (language_code);
+       if (language->name == NULL)
+       {
+               /* Translators: %s is the language ISO code. */
+               language->name = g_strdup_printf (C_("language", "Unknown (%s)"), language_code);
+       }
+
        language->collate_key = g_utf8_collate_key (language->name, -1);
 
        *available_languages = g_list_prepend (*available_languages, language);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]