Enlightenment CVS committal

Author  : stffrdhrn
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_intl.c e_intl.h 


Log Message:
Fix some problems with validation.
- Validation function now canonicalizes the "locale -a" output
- Searching for locale directory now canonicalizes the path files

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_intl.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -3 -r1.65 -r1.66
--- e_intl.c    4 Dec 2005 12:28:34 -0000       1.65
+++ e_intl.c    7 Dec 2005 17:09:02 -0000       1.66
@@ -225,7 +225,7 @@
              if (locale_path == NULL)
               {
                  fprintf(stderr, "The eMonkeys can not find the "
-                        " eTranslation for your eLocale(%s). "
+                        "eTranslation for your eLocale(%s). "
                         "Please make sure your messages "
                         "path is in order. If this locale "
                         "is an alias make sure you have your "
@@ -507,25 +507,45 @@
    found = 0;
    dir_list = e_path_dir_list_get(path_messages);
    
-   /* delete dir list as we go ? */
+   /* For each directory in the path */
    for (next_dir = dir_list ; next_dir ; next_dir = next_dir->next)
      {
        E_Path_Dir *epd;
+       Ecore_List *files;
        epd = next_dir->data;
        
-       for (next_search = search_list ; next_search && !found ; next_search = 
next_search->next)
-          {
-             char message_path[PATH_MAX];
-             char *search_locale;
-             
-             search_locale = next_search->data;
-             snprintf(message_path, sizeof(message_path), 
"%s/%s/LC_MESSAGES/%s.mo",
-                      epd->dir, search_locale, PACKAGE);
-             if (ecore_file_exists(message_path) && 
!ecore_file_is_dir(message_path))
-               {
-                  directory = strdup(epd->dir);
-               }
-          }
+       /* For each directory in the locale path */
+       files = ecore_file_ls(epd->dir);
+       if (files)
+         {
+            char *file;
+            
+            ecore_list_goto_first(files);
+            while (file = ecore_list_next(files))
+              {
+                 /* Match canonicalized locale against each possible search */
+                 for (next_search = search_list ; next_search && !found ; 
next_search = next_search->next)
+                   {
+                      char *clean_file;
+                      char *search_locale;
+                      
+                      search_locale = next_search->data;
+                      clean_file = _e_intl_locale_canonic_get(file, E_LOC_ALL);
+                      /* Match directory with the search locale */
+                      if (clean_file && !strcmp(clean_file, search_locale))
+                        {
+                           char message_path[PATH_MAX];
+                           snprintf(message_path, sizeof(message_path), 
"%s/%s/LC_MESSAGES/%s.mo", epd->dir, search_locale, PACKAGE);
+                           if (ecore_file_exists(message_path) && 
!ecore_file_is_dir(message_path))
+                             {
+                                directory = strdup(epd->dir);
+                             }
+                           free(clean_file);
+                        }
+                   } 
+              }
+            ecore_list_destroy(files);
+         }
      }
    
    e_path_dir_list_free(dir_list);
@@ -878,7 +898,19 @@
 
        if (found == 0)
          {
-            if (!strcmp(test_locale, search_locale)) found = 1;
+            char *clean_test_locale;
+            
+            /* FOR BSD, need to canonicalize the locale from "locale -a" */ 
+            clean_test_locale = _e_intl_locale_canonic_get(test_locale, 
E_LOC_ALL);
+            if (clean_test_locale)
+              {
+                 if (!strcmp(clean_test_locale, search_locale)) found = 1;
+                 free(clean_test_locale);
+              }
+            else
+              {
+                 if (!strcmp(test_locale, search_locale)) found = 1;
+              }
          }
        
        all_locales = evas_list_remove_list(all_locales, all_locales);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_intl.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- e_intl.h    22 Nov 2005 13:28:10 -0000      1.8
+++ e_intl.h    7 Dec 2005 17:09:02 -0000       1.9
@@ -21,11 +21,11 @@
 
 struct _E_Language_Pack
 {
-   int version;
-   char *e_lp_name;
-   char *lang;
-   char *input_method;
-   char *font_fallbacks;
+   int          language_pack_version;
+   char                *language_pack_name;
+   char                *language;
+   char                *input_method;
+   Evas_List   *font_fallbacks;
 };
 
 struct _E_Input_Method_Config




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to