Isolated ICU locale out of XML config file. Locale is now the second argument to...
[yaz-moved-to-github.git] / util / yaz-icu.c
index d929229..a876186 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: yaz-icu.c,v 1.2 2007-10-22 17:32:08 adam Exp $
+ * $Id: yaz-icu.c,v 1.3 2007-10-24 14:48:18 marc Exp $
  */
 
 #if HAVE_CONFIG_H
@@ -428,6 +428,7 @@ static void process_text_file(const struct config_t *p_config)
  
     xmlDoc *doc = xmlParseFile(config.conffile);  
     xmlNode *xml_node = xmlDocGetRootElement(doc);
+    xmlChar *xml_locale = xmlGetProp(xml_node, (xmlChar *) "locale");
 
     long unsigned int token_count = 0;    
     long unsigned int line_count = 0;    
@@ -441,8 +442,13 @@ static void process_text_file(const struct config_t *p_config)
         exit (1);
     }
 
+    if (!xml_locale || !strlen((const char *) xml_locale))
+        return;        
     
-    config.chain = icu_chain_xml_config(xml_node, &status);
+    config.chain = icu_chain_xml_config(xml_node, (uint8_t *) "en", &status);
+
+    xmlFree(xml_locale);
+
 
     if (config.chain && U_SUCCESS(status))
         success = 1;
@@ -452,6 +458,8 @@ static void process_text_file(const struct config_t *p_config)
         exit (1);
     }
     
+
+
     if (p_config->xmloutput)
         fprintf(config.outfile,
                 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"