Enlightenment CVS committal

Author  : shorne
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_int_config_intl.c 


Log Message:
Do charset translations to Upper case form. 

On, BSD and some applications in Linux the codeset needs to be in the form
listed in 'charsets' manpage.  I.e. utf8 is not good must be UTF-8.  Since
there seems to way to way to get those lists I just added a list in the 
code.  It includes all the charsets I can find which are listed in my locale 
-a. 

Let me know if anyone knows how to do this programatically on both Linux and
BSD. 

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_intl.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- e_int_config_intl.c 8 Oct 2006 08:04:17 -0000       1.10
+++ e_int_config_intl.c 9 Oct 2006 14:44:41 -0000       1.11
@@ -509,6 +509,55 @@
        { NULL, NULL}
 };
 
+/* This comes from 
+   $ man charsets
+ * and 
+   $ locale -a | grep -v @ | grep "\." | cut -d . -f 2 | sort -u
+ *
+ * On some machines is complains if codesets don't look like this
+ * On linux its not really a problem but BSD has issues. So we neet to 
+ * make sure that locale -a output gets converted to upper-case form in
+ * all situations just to be safe. 
+ */
+const E_Intl_Pair charset_predefined_pairs[ ] = {
+       /* These are in locale -a but not in charsets */
+       {"cp1255", "CP1255"},
+       {"euc", "EUC"},
+       {"georgianps", "GEORGIAN-PS"},
+       {"iso885914", "ISO-8859-14"},
+       {"koi8t", "KOI8-T"},
+       {"tcvn", "TCVN"},
+       {"ujis", "UJIS"},
+
+       /* These are from charsets man page */
+       {"big5", "BIG5"},
+       {"big5hkscs", "BIG5-HKSCS"},
+       {"cp1251", "CP1251"},
+       {"eucjp", "EUC-JP"},
+       {"euckr", "EUC-KR"},
+       {"euctw", "EUC-TW"},
+       {"gb18030", "GB18030"},
+       {"gb2312", "GB2312"},
+       {"gbk", "GBK"},
+       {"iso88591", "ISO-8859-1"},
+       {"iso885913", "ISO-8859-13"},
+       {"iso885915", "ISO-8859-15"},
+       {"iso88592", "ISO-8859-2"},
+       {"iso88593", "ISO-8859-3"},
+       {"iso88595", "ISO-8859-5"},
+       {"iso88596", "ISO-8859-6"},
+       {"iso88597", "ISO-8859-7"},
+       {"iso88598", "ISO-8859-8"},
+       {"iso88599", "ISO-8859-9"},
+       {"koi8r", "KOI8-R"},
+       {"koi8u", "KOI8-U"},
+       {"tis620", "TIS-620"},
+       {"utf8", "UTF-8"},
+       { NULL, NULL }
+};
+
+
+
 EAPI E_Config_Dialog *
 e_int_config_intl(E_Container *con)
 {
@@ -607,8 +656,10 @@
                       while (language_predefined_pairs[i].locale_key)
                         {
                            if 
(!strcmp(language_predefined_pairs[i].locale_key, language))
-                             lang_node->lang_name = 
_(language_predefined_pairs[i].locale_translation);
-                             
+                             {
+                                lang_node->lang_name = 
_(language_predefined_pairs[i].locale_translation);
+                                break;
+                             }
                            i++;
                         }
                       
@@ -636,7 +687,10 @@
                            while (region_predefined_pairs[i].locale_key)
                              {
                                 if 
(!strcmp(region_predefined_pairs[i].locale_key, region))
-                                  region_node->region_name = 
_(region_predefined_pairs[i].locale_translation);
+                                  {
+                                     region_node->region_name = 
_(region_predefined_pairs[i].locale_translation);
+                                     break;
+                                  }
                                 i++;
                              }
                            lang_node->region_hash = 
evas_hash_add(lang_node->region_hash, region, region_node);
@@ -646,9 +700,24 @@
                       /* Add codeset to the region hash node if it exists */
                       if (codeset)
                         {
+                           int i;
                            const char * cs;
                            
-                           cs = evas_stringshare_add(codeset);
+                           /* get the charset UpperCase form */
+                           /* linear serach */
+                           i = 0;
+                           cs = NULL;
+                           while (charset_predefined_pairs[i].locale_key)
+                             {
+                                if 
(!strcmp(charset_predefined_pairs[i].locale_key, codeset))
+                                  {
+                                     cs = 
evas_stringshare_add(charset_predefined_pairs[i].locale_translation);
+                                     break;
+                                  }
+                                i++;
+                             }
+                           
+                           if (cs == NULL) cs = evas_stringshare_add(codeset);
                            /* Exclusive */
                            /* Linear Search */
                            if 
(!evas_list_find(region_node->available_codesets, cs))



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to