[gnome-control-center/gnome-3-6] common: Fix other user's languages never getting added



commit 63912d28b450656de8667961ee577fc256b0a585
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Dec 10 15:06:14 2012 +0100

    common: Fix other user's languages never getting added
    
    Because we were looking for a locale directory with the extra
    codeset (xx_XX.utf8) instead of without it.
    
    Conflicts:
    	panels/common/cc-common-language.c

 panels/common/cc-common-language.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/panels/common/cc-common-language.c b/panels/common/cc-common-language.c
index 31e54d7..1f8f33a 100644
--- a/panels/common/cc-common-language.c
+++ b/panels/common/cc-common-language.c
@@ -440,6 +440,28 @@ cc_common_language_select_current_language (GtkTreeView *treeview)
 		g_warning ("Could not find current language '%s' in the treeview", lang);
 }
 
+static gboolean
+user_language_has_translations (const char *locale)
+{
+        char *name, *language_code, *territory_code;
+        gboolean ret;
+
+        gdm_parse_language_name (locale,
+                                 &language_code,
+                                 &territory_code,
+                                 NULL, NULL);
+        name = g_strdup_printf ("%s%s%s",
+                                language_code,
+                                territory_code != NULL? "_" : "",
+                                territory_code != NULL? territory_code : "");
+        g_free (language_code);
+        g_free (territory_code);
+        ret = gdm_language_has_translations (name);
+        g_free (name);
+
+        return ret;
+}
+
 static void
 add_other_users_language (GHashTable *ht)
 {
@@ -501,7 +523,7 @@ add_other_users_language (GHashTable *ht)
                 lang = g_variant_get_string (props, NULL);
                 if (lang != NULL && *lang != '\0' &&
                     cc_common_language_has_font (lang) &&
-                    gdm_language_has_translations (lang)) {
+                    user_language_has_translations (lang)) {
                         name = gdm_normalize_language_name (lang);
                         if (!g_hash_table_lookup (ht, name)) {
                                 language = gdm_get_language_from_name (name, NULL);



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