[gcompris] core: now handle the 'C' locale as en_US Currently a 'C' locale was interpreted in GCompris by Catal



commit 61941e227fc78b137a4df291411cb687a4e095d9
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Thu Oct 27 02:54:26 2011 +0200

    core: now handle the 'C' locale as en_US
    Currently a 'C' locale was interpreted in GCompris by Catalan.

 src/gcompris/config.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/src/gcompris/config.c b/src/gcompris/config.c
index 200e78d..48fd833 100644
--- a/src/gcompris/config.c
+++ b/src/gcompris/config.c
@@ -489,13 +489,16 @@ void gc_config_stop ()
  * The result must not be freed.
  */
 const gchar*
-gc_locale_get_name(const gchar *locale)
+gc_locale_get_name(const gchar *locale_code)
 {
   guint i = 0;
-
+  const gchar *locale = locale_code;
   if ( !locale )
     return NULL;
 
+  if( !g_ascii_strncasecmp(locale, "C", 1) )
+      locale = GC_DEFAULT_LOCALE;
+
   /*
    * On some systems, locales are returned as fr_FR.utf8
    * but in GCompris we use fr_FR.UTF-8
@@ -522,11 +525,15 @@ gc_locale_get_name(const gchar *locale)
  * The result must be freed.
  */
 gchar*
-gc_locale_short(const gchar *locale)
+gc_locale_short(const gchar *locale_code)
 {
-  if ( ! locale )
+   const gchar *locale = locale_code;
+   if ( ! locale )
     return NULL;
 
+  if( !g_ascii_strncasecmp(locale, "C", 1) )
+      locale = GC_DEFAULT_LOCALE;
+
   gchar **locale_short = g_strsplit_set(locale, "_", 2);
   if(g_strv_length(locale_short) >= 1)
     {
@@ -546,11 +553,15 @@ gc_locale_short(const gchar *locale)
  * The result must be freed.
  */
 gchar*
-gc_locale_long(const gchar *locale)
+gc_locale_long(const gchar *locale_code)
 {
+  const gchar *locale = locale_code;
   if ( ! locale )
     return NULL;
 
+  if( !g_ascii_strncasecmp(locale, "C", 1) )
+    locale = GC_DEFAULT_LOCALE;
+
   gchar **locale_long = g_strsplit_set(locale, ".", 2);
   if(g_strv_length(locale_long) >= 1)
     {



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