bug fixed: [0000190] translation process now parses all files in case no system languages defined, this creates textinterfaces headers in case they are needed
authorAsier Lostalé <asier.lostale@openbravo.com>
Mon, 12 May 2008 09:29:25 +0000
changeset 870 ee863a6c7563
parent 869 143e434ffe16
child 871 b9084eea924e
bug fixed: [0000190] translation process now parses all files in case no system languages defined, this creates textinterfaces headers in case they are needed
src-db/database/sourcedata/AD_TEXTINTERFACES.xml
src-trl/src/org/openbravo/translate/Translate.java
src/log4j.lcf
--- a/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Mon May 12 09:28:54 2008 +0000
+++ b/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Mon May 12 09:29:25 2008 +0000
@@ -19651,7 +19651,7 @@
 <!--807023 TEXT-->
 <!--807023-->              <TEXT><![CDATA[Amount From ]]></TEXT>
 <!--807023 ISUSED-->
-<!--807023-->              <ISUSED><![CDATA[N]]></ISUSED>
+<!--807023-->              <ISUSED><![CDATA[Y]]></ISUSED>
 <!--807023**************--></AD_TEXTINTERFACES>
 
 <!--807025**************--><AD_TEXTINTERFACES>
@@ -35371,6 +35371,156 @@
 <!--1000100012-->              <ISUSED><![CDATA[Y]]></ISUSED>
 <!--1000100012**************--></AD_TEXTINTERFACES>
 
+<!--1000100013**************--><AD_TEXTINTERFACES>
+<!--1000100013 AD_TEXTINTERFACES_ID-->
+<!--1000100013-->              <AD_TEXTINTERFACES_ID><![CDATA[1000100013]]></AD_TEXTINTERFACES_ID>
+<!--1000100013 AD_CLIENT_ID-->
+<!--1000100013-->              <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--1000100013 AD_ORG_ID-->
+<!--1000100013-->              <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--1000100013 ISACTIVE-->
+<!--1000100013-->              <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--1000100013 CREATED-->
+<!--1000100013-->              <CREATED><![CDATA[2008-05-12 11:16:20.0]]></CREATED>
+<!--1000100013 CREATEDBY-->
+<!--1000100013-->              <CREATEDBY><![CDATA[0]]></CREATEDBY>
+<!--1000100013 UPDATED-->
+<!--1000100013-->              <UPDATED><![CDATA[2008-05-12 11:16:20.0]]></UPDATED>
+<!--1000100013 UPDATEDBY-->
+<!--1000100013-->              <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
+<!--1000100013 TEXT-->
+<!--1000100013-->              <TEXT><![CDATA[Create Vat Register Process]]></TEXT>
+<!--1000100013 FILENAME-->
+<!--1000100013-->              <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters.html]]></FILENAME>
+<!--1000100013 ISUSED-->
+<!--1000100013-->              <ISUSED><![CDATA[Y]]></ISUSED>
+<!--1000100013**************--></AD_TEXTINTERFACES>
+
+<!--1000100014**************--><AD_TEXTINTERFACES>
+<!--1000100014 AD_TEXTINTERFACES_ID-->
+<!--1000100014-->              <AD_TEXTINTERFACES_ID><![CDATA[1000100014]]></AD_TEXTINTERFACES_ID>
+<!--1000100014 AD_CLIENT_ID-->
+<!--1000100014-->              <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--1000100014 AD_ORG_ID-->
+<!--1000100014-->              <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--1000100014 ISACTIVE-->
+<!--1000100014-->              <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--1000100014 CREATED-->
+<!--1000100014-->              <CREATED><![CDATA[2008-05-12 11:16:20.0]]></CREATED>
+<!--1000100014 CREATEDBY-->
+<!--1000100014-->              <CREATEDBY><![CDATA[0]]></CREATEDBY>
+<!--1000100014 UPDATED-->
+<!--1000100014-->              <UPDATED><![CDATA[2008-05-12 11:16:20.0]]></UPDATED>
+<!--1000100014 UPDATEDBY-->
+<!--1000100014-->              <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
+<!--1000100014 TEXT-->
+<!--1000100014-->              <TEXT><![CDATA[From Date]]></TEXT>
+<!--1000100014 FILENAME-->
+<!--1000100014-->              <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters.html]]></FILENAME>
+<!--1000100014 ISUSED-->
+<!--1000100014-->              <ISUSED><![CDATA[Y]]></ISUSED>
+<!--1000100014**************--></AD_TEXTINTERFACES>
+
+<!--1000100015**************--><AD_TEXTINTERFACES>
+<!--1000100015 AD_TEXTINTERFACES_ID-->
+<!--1000100015-->              <AD_TEXTINTERFACES_ID><![CDATA[1000100015]]></AD_TEXTINTERFACES_ID>
+<!--1000100015 AD_CLIENT_ID-->
+<!--1000100015-->              <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--1000100015 AD_ORG_ID-->
+<!--1000100015-->              <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--1000100015 ISACTIVE-->
+<!--1000100015-->              <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--1000100015 CREATED-->
+<!--1000100015-->              <CREATED><![CDATA[2008-05-12 11:16:20.0]]></CREATED>
+<!--1000100015 CREATEDBY-->
+<!--1000100015-->              <CREATEDBY><![CDATA[0]]></CREATEDBY>
+<!--1000100015 UPDATED-->
+<!--1000100015-->              <UPDATED><![CDATA[2008-05-12 11:16:20.0]]></UPDATED>
+<!--1000100015 UPDATEDBY-->
+<!--1000100015-->              <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
+<!--1000100015 TEXT-->
+<!--1000100015-->              <TEXT><![CDATA[To Date]]></TEXT>
+<!--1000100015 FILENAME-->
+<!--1000100015-->              <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters.html]]></FILENAME>
+<!--1000100015 ISUSED-->
+<!--1000100015-->              <ISUSED><![CDATA[Y]]></ISUSED>
+<!--1000100015**************--></AD_TEXTINTERFACES>
+
+<!--1000100016**************--><AD_TEXTINTERFACES>
+<!--1000100016 AD_TEXTINTERFACES_ID-->
+<!--1000100016-->              <AD_TEXTINTERFACES_ID><![CDATA[1000100016]]></AD_TEXTINTERFACES_ID>
+<!--1000100016 AD_CLIENT_ID-->
+<!--1000100016-->              <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--1000100016 AD_ORG_ID-->
+<!--1000100016-->              <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--1000100016 ISACTIVE-->
+<!--1000100016-->              <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--1000100016 CREATED-->
+<!--1000100016-->              <CREATED><![CDATA[2008-05-12 11:16:27.0]]></CREATED>
+<!--1000100016 CREATEDBY-->
+<!--1000100016-->              <CREATEDBY><![CDATA[0]]></CREATEDBY>
+<!--1000100016 UPDATED-->
+<!--1000100016-->              <UPDATED><![CDATA[2008-05-12 11:16:27.0]]></UPDATED>
+<!--1000100016 UPDATEDBY-->
+<!--1000100016-->              <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
+<!--1000100016 TEXT-->
+<!--1000100016-->              <TEXT><![CDATA[class="TitleCell">]]></TEXT>
+<!--1000100016 FILENAME-->
+<!--1000100016-->              <FILENAME><![CDATA[/org/openbravo/erpCommon/info/Invoice.html]]></FILENAME>
+<!--1000100016 ISUSED-->
+<!--1000100016-->              <ISUSED><![CDATA[Y]]></ISUSED>
+<!--1000100016**************--></AD_TEXTINTERFACES>
+
+<!--1000100017**************--><AD_TEXTINTERFACES>
+<!--1000100017 AD_TEXTINTERFACES_ID-->
+<!--1000100017-->              <AD_TEXTINTERFACES_ID><![CDATA[1000100017]]></AD_TEXTINTERFACES_ID>
+<!--1000100017 AD_CLIENT_ID-->
+<!--1000100017-->              <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--1000100017 AD_ORG_ID-->
+<!--1000100017-->              <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--1000100017 ISACTIVE-->
+<!--1000100017-->              <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--1000100017 CREATED-->
+<!--1000100017-->              <CREATED><![CDATA[2008-05-12 11:17:56.0]]></CREATED>
+<!--1000100017 CREATEDBY-->
+<!--1000100017-->              <CREATEDBY><![CDATA[0]]></CREATEDBY>
+<!--1000100017 UPDATED-->
+<!--1000100017-->              <UPDATED><![CDATA[2008-05-12 11:17:56.0]]></UPDATED>
+<!--1000100017 UPDATEDBY-->
+<!--1000100017-->              <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
+<!--1000100017 TEXT-->
+<!--1000100017-->              <TEXT><![CDATA[Oggetto : certificazione dei compensi assoggettati a ritenuta d'acconto (art. DPR 29 Settembre 1973 n° 600)]]></TEXT>
+<!--1000100017 FILENAME-->
+<!--1000100017-->              <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportAnnualCertification.jrxml]]></FILENAME>
+<!--1000100017 ISUSED-->
+<!--1000100017-->              <ISUSED><![CDATA[Y]]></ISUSED>
+<!--1000100017**************--></AD_TEXTINTERFACES>
+
+<!--1000100018**************--><AD_TEXTINTERFACES>
+<!--1000100018 AD_TEXTINTERFACES_ID-->
+<!--1000100018-->              <AD_TEXTINTERFACES_ID><![CDATA[1000100018]]></AD_TEXTINTERFACES_ID>
+<!--1000100018 AD_CLIENT_ID-->
+<!--1000100018-->              <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--1000100018 AD_ORG_ID-->
+<!--1000100018-->              <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--1000100018 ISACTIVE-->
+<!--1000100018-->              <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--1000100018 CREATED-->
+<!--1000100018-->              <CREATED><![CDATA[2008-05-12 11:17:56.0]]></CREATED>
+<!--1000100018 CREATEDBY-->
+<!--1000100018-->              <CREATEDBY><![CDATA[0]]></CREATEDBY>
+<!--1000100018 UPDATED-->
+<!--1000100018-->              <UPDATED><![CDATA[2008-05-12 11:17:56.0]]></UPDATED>
+<!--1000100018 UPDATEDBY-->
+<!--1000100018-->              <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
+<!--1000100018 TEXT-->
+<!--1000100018-->              <TEXT><![CDATA[e l'importo della ritenuta d'acconto operata è di Euro]]></TEXT>
+<!--1000100018 FILENAME-->
+<!--1000100018-->              <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportAnnualCertification.jrxml]]></FILENAME>
+<!--1000100018 ISUSED-->
+<!--1000100018-->              <ISUSED><![CDATA[Y]]></ISUSED>
+<!--1000100018**************--></AD_TEXTINTERFACES>
+
 <!--1000200000**************--><AD_TEXTINTERFACES>
 <!--1000200000 AD_TEXTINTERFACES_ID-->
 <!--1000200000-->              <AD_TEXTINTERFACES_ID><![CDATA[1000200000]]></AD_TEXTINTERFACES_ID>
@@ -35818,7 +35968,7 @@
 <!--1000500008 FILENAME-->
 <!--1000500008-->              <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.html]]></FILENAME>
 <!--1000500008 ISUSED-->
-<!--1000500008-->              <ISUSED><![CDATA[N]]></ISUSED>
+<!--1000500008-->              <ISUSED><![CDATA[Y]]></ISUSED>
 <!--1000500008**************--></AD_TEXTINTERFACES>
 
 <!--1000500009**************--><AD_TEXTINTERFACES>
--- a/src-trl/src/org/openbravo/translate/Translate.java	Mon May 12 09:28:54 2008 +0000
+++ b/src-trl/src/org/openbravo/translate/Translate.java	Mon May 12 09:29:25 2008 +0000
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SL 
- * All portions are Copyright (C) 2001-2006 Openbravo SL 
+ * All portions are Copyright (C) 2001-2008 Openbravo SL 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -89,6 +89,7 @@
     parser.setContentHandler(this);
     fromLanguage = TranslateData.baseLanguage(pool);
     toLanguage = TranslateData.systemLanguage(pool);
+    if (toLanguage.length==0) log4j.warn("No system languages defined, translation will parse all files.");
   }
 
   /**
@@ -193,6 +194,10 @@
             actualLanguage = toLanguage[h].name;
             parseFile(list[i], fileFin, relativePath);
           }
+          if (toLanguage.length==0) {
+            actualLanguage="";
+            parseFile(list[i], fileFin, relativePath);
+          }
         } catch (IOException e) {
           log4j.error("IOException: " + e);
         }
@@ -218,29 +223,33 @@
     String strFileWithoutTermination = strFileName.substring(0, pos);
     if (log4j.isDebugEnabled()) log4j.debug("File without termination: " + strFileWithoutTermination);
     actualFile = relativePath + "/" + strFileName;
+    FileOutputStream resultsFile = null;
     try {
-      if (log4j.isDebugEnabled()) log4j.debug("Relative path: " + actualLanguage + "/" + relativePath);
-      File dirHTML = new File(fileFin, actualLanguage + "/" + relativePath);
-      if (log4j.isDebugEnabled()) log4j.debug(" dirHTML: " + dirHTML);
-      dirHTML.mkdirs();
-      File fileHTML = new File(dirHTML, strFileWithoutTermination + fileTermination);
-      if (log4j.isDebugEnabled()) log4j.debug(" fileHTML: " + fileHTML);
-      if (log4j.isDebugEnabled()) log4j.debug(" time file parsed: " + fileParsing.lastModified() + " time file HTML new: " + fileHTML.lastModified());
-      if (fileHTML.exists()) {
-        /*java.util.Date lastModified = new java.util.Date(fileHTML.lastModified());
-        java.util.Calendar modificationReference = java.util.Calendar.getInstance();
-        modificationReference.add(java.util.Calendar.MINUTE, -10);
-        if (lastModified.compareTo(modificationReference.getTime()) < 0) return;*/
-        java.util.Date newFileModified = new java.util.Date(fileHTML.lastModified());
-        java.util.Date oldFileModified = new java.util.Date(fileParsing.lastModified());
-        //if (count == 0) System.out.println("******************** " + newFileModified.compareTo(oldFileModified) + " - " + newFileModified + " - " + oldFileModified);
-        //if (newFileModified.compareTo(oldFileModified) > 0) return;
-        if (/*!fileTermination.equalsIgnoreCase("jrxml") && */newFileModified.compareTo(oldFileModified) > 0) return;
-        //if (fileHTML.lastModified()>= fileParsing.lastModified()) return;
+      
+      File dirHTML = null;
+      File fileHTML = null;
+      if (!actualLanguage.equals("")) { //actualLangue == "" when no system languages in DB
+        dirHTML = new File(fileFin, actualLanguage + "/" + relativePath);
+        dirHTML.mkdirs();
+        fileHTML = new File(dirHTML, strFileWithoutTermination + fileTermination);
+        if (log4j.isDebugEnabled()) {
+          log4j.debug("Relative path: " + actualLanguage + "/" + relativePath);
+          log4j.debug(" dirHTML: " + dirHTML);
+          log4j.debug(" fileHTML: " + fileHTML);
+          log4j.debug(" time file parsed: " + fileParsing.lastModified() + " time file HTML new: " + fileHTML.lastModified());
+        }
+        if (fileHTML.exists()) {
+          java.util.Date newFileModified = new java.util.Date(fileHTML.lastModified());
+          java.util.Date oldFileModified = new java.util.Date(fileParsing.lastModified());
+          if (newFileModified.compareTo(oldFileModified) > 0) return;
+        }
+        resultsFile = new FileOutputStream(fileHTML);
+        out  = new OutputStreamWriter(resultsFile, "UTF-8");
       }
+      
+      
       count++;
-      FileOutputStream resultsFile = new FileOutputStream(fileHTML);
-      out  = new OutputStreamWriter(resultsFile, "UTF-8");
+      
 
       strBuffer = new StringBuffer();
       log4j.info("F " + fileParsing);
@@ -248,7 +257,6 @@
       if (log4j.isDebugEnabled()) log4j.debug("Hour: " + date.getTime());
       error = false;
       try {
-//          parser.parse(fileParsing.getAbsolutePath());
         parser.parse(new InputSource(new FileReader(fileParsing)));
       } catch (IOException e) {
         log4j.error("file: " + actualFile);
@@ -257,9 +265,11 @@
         log4j.error("file: " + actualFile);
         e.printStackTrace();
       }
-      out.write(strBuffer.toString());
-      out.flush();
-      resultsFile.close();
+      if (!actualLanguage.equals("")) {
+        out.write(strBuffer.toString());
+        out.flush();
+        resultsFile.close();
+      }
       if (error) {
 //          fileHTML.delete();
       }
--- a/src/log4j.lcf	Mon May 12 09:28:54 2008 +0000
+++ b/src/log4j.lcf	Mon May 12 09:29:25 2008 +0000
@@ -26,4 +26,4 @@
 
 log4j.category.org.openbravo.data.Sqlc=INFO
 log4j.category.org.openbravo.wad=INFO
-#log4j.category.org.openbravo.translate=DEBUG
+#log4j.category.org.openbravo.translate=INFO