[gcompris] Better sub locale support in gc_locale_get_name
- From: Bruno Coudoin <bcoudoin src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gcompris] Better sub locale support in gc_locale_get_name
 
- Date: Wed,  1 May 2013 23:22:59 +0000 (UTC)
 
commit a1f950cadcd27014f38887d831903d493b0184fa
Author: Bruno Coudoin <bcoudoin rcsmobility com>
Date:   Thu May 2 01:21:20 2013 +0200
    Better sub locale support in gc_locale_get_name
    
    For example, a fr_CH locale was not proposing French
    in the hang game activity.
 src/gcompris/config.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/gcompris/config.c b/src/gcompris/config.c
index 6cd32df..9c864fa 100644
--- a/src/gcompris/config.c
+++ b/src/gcompris/config.c
@@ -546,6 +546,18 @@ gc_locale_get_name(const gchar *locale_code)
 
       i=i+2;
     }
+
+  dot_char = g_strrstr ( locale, "_");
+  i = 0;
+  while(linguas[i] != NULL)
+    {
+
+      if( !g_ascii_strncasecmp(locale, linguas[i],
+                              (dot_char ? dot_char - locale : strlen(locale)) ) )
+       return(gettext(linguas[i+1]));
+
+      i=i+2;
+    }
   // Oups this locale is not in the table.
   return( NULL );
 }
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]