[gnome-initial-setup] language: Also show UTF-8 locales which are not suffixed with .utf8



commit c3d842f28db30ae6968769083fd1db26407d81f1
Author: Colin Walters <walters verbum org>
Date:   Wed Oct 2 10:30:40 2013 -0400

    language: Also show UTF-8 locales which are not suffixed with .utf8
    
    On at least Fedora, "locale -a" offers many locale variants which
    differ only by codeset; for example both "en_US" (which uses
    ISO-8859-1) and "en_US.utf8".
    
    This suffixing code (which apparently long ago derives from
    gdm-language.c), is hardcoded to suffix .utf8.  If those variants
    *aren't* available (because the system just defaults to utf8, as is
    the case with OpenEmbedded's eglibc), then we end up hiding the
    languages.
    
    But gnome-desktop has already validated all of the locales it returns
    actually *are* UTF-8, via language_name_get_codeset_details().
    
    Since we treat the list of languages from gnome-desktop as canonical,
    we can just add both variants to the initial set.  This might cause
    duplicated output for a system which happened to have both en_US
    (UTF-8) and en_US.utf8.  But there's no reason to do that really, so
    if someone does, we can tell them to just have en_US, and drop the
    .utf8.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709272

 .../pages/language/cc-common-language.c            |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/gnome-initial-setup/pages/language/cc-common-language.c 
b/gnome-initial-setup/pages/language/cc-common-language.c
index 129a67b..04f0c84 100644
--- a/gnome-initial-setup/pages/language/cc-common-language.c
+++ b/gnome-initial-setup/pages/language/cc-common-language.c
@@ -231,8 +231,8 @@ add_other_users_language (GHashTable *ht)
 }
 
 static void
-insert_language (GHashTable *ht,
-                 const char *lang)
+insert_language_internal (GHashTable *ht,
+                          const char *lang)
 {
         gboolean has_translations;
         char *label_own_lang;
@@ -252,7 +252,7 @@ insert_language (GHashTable *ht,
 
         g_debug ("We have translations for %s", lang);
 
-        key = g_strdup_printf ("%s.utf8", lang);
+        key = g_strdup (lang);
 
         label_own_lang = gnome_get_language_from_locale (key, key);
         label_current_lang = gnome_get_language_from_locale (key, NULL);
@@ -275,6 +275,16 @@ insert_language (GHashTable *ht,
 }
 
 static void
+insert_language (GHashTable *ht,
+                 const char *lang)
+{
+        char *utf8_variant = g_strconcat (lang, ".utf8", NULL);
+        insert_language_internal (ht, lang);
+        insert_language_internal (ht, utf8_variant);
+        g_free (utf8_variant);
+}
+
+static void
 insert_user_languages (GHashTable *ht)
 {
         char *name;


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