openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1516418 - in /openoffice/branches/l10n40/main/l10ntools/source: gConPoWrap.cxx gConXcu.hxx gConXcuWrap.cxx gHandler.cxx gL10nMem.cxx gL10nMem.hxx gLang.hxx
Date Thu, 22 Aug 2013 11:32:51 GMT
Author: jani
Date: Thu Aug 22 11:32:50 2013
New Revision: 1516418

URL: http://svn.apache.org/r1516418
Log:
allow x-no-translate to work, and generate .pot files for templates.

Modified:
    openoffice/branches/l10n40/main/l10ntools/source/gConPoWrap.cxx
    openoffice/branches/l10n40/main/l10ntools/source/gConXcu.hxx
    openoffice/branches/l10n40/main/l10ntools/source/gConXcuWrap.cxx
    openoffice/branches/l10n40/main/l10ntools/source/gHandler.cxx
    openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.cxx
    openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.hxx
    openoffice/branches/l10n40/main/l10ntools/source/gLang.hxx

Modified: openoffice/branches/l10n40/main/l10ntools/source/gConPoWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/l10ntools/source/gConPoWrap.cxx?rev=1516418&r1=1516417&r2=1516418&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/l10ntools/source/gConPoWrap.cxx (original)
+++ openoffice/branches/l10n40/main/l10ntools/source/gConPoWrap.cxx Thu Aug 22 11:32:50 2013
@@ -169,7 +169,7 @@ void convert_po::execute()
 void convert_po::startSave(const std::string& sLanguage,
                            const std::string& sFile)
 {
-  std::string sFilePath = msTargetPath + sLanguage + "/" + sFile;
+  std::string sFilePath = msTargetPath + sLanguage + sFile;
   outBuffer.open(sFilePath.c_str(), std::ios::out);
 
   if (!outBuffer.is_open())

Modified: openoffice/branches/l10n40/main/l10ntools/source/gConXcu.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/l10ntools/source/gConXcu.hxx?rev=1516418&r1=1516417&r2=1516418&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/l10ntools/source/gConXcu.hxx (original)
+++ openoffice/branches/l10n40/main/l10ntools/source/gConXcu.hxx Thu Aug 22 11:32:50 2013
@@ -54,6 +54,7 @@ class convert_xcu : public convert_gen_i
   private:
     std::vector<std::string> mcStack;
     int                      miLevel;
+    bool                     mbNoTranslate;
 
     void execute();
 };

Modified: openoffice/branches/l10n40/main/l10ntools/source/gConXcuWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/l10ntools/source/gConXcuWrap.cxx?rev=1516418&r1=1516417&r2=1516418&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/l10ntools/source/gConXcuWrap.cxx (original)
+++ openoffice/branches/l10n40/main/l10ntools/source/gConXcuWrap.cxx Thu Aug 22 11:32:50 2013
@@ -36,7 +36,8 @@
 convert_xcu::convert_xcu(l10nMem& crMemory)
                         : convert_gen_impl(crMemory),
                           mbNoCollectingData(true),
-                          miLevel(0)
+                          miLevel(0),
+                          mbNoTranslate(false)
 {
 }
 
@@ -96,6 +97,8 @@ void convert_xcu::popKey(char *syyText)
   // check for correct node/prop relations
   if (mcStack.size())
     mcStack.pop_back();
+
+  mbNoTranslate = false;
 }
 
 
@@ -106,19 +109,24 @@ void convert_xcu::startCollectData(char 
   int nL;
   std::string sTag = copySource(syyText);
 
+  if (mbNoTranslate)
+    return;
+
   // locate object name
   nL = sTag.find("xml:lang=\"");
   if (nL != (int)std::string::npos)
   {
     // test langauge
     nL += 10;
-    if (sTag.substr(nL,5) != "en-US")
+    if (sTag.substr(nL,5) == "en-US")
+      mbNoCollectingData = false;
+    else if (sTag.substr(nL,14) == "x-no-translate")
+      mbNoTranslate = true;
+    else
     {
       std::string sErr = sTag.substr(nL,5) + " is not en-US";
       mcMemory.showError(sErr);
     }
-    else
-      mbNoCollectingData = false;
   }
 }
 
@@ -133,7 +141,7 @@ void convert_xcu::stopCollectData(char *
   copySource(syyText);
 
   // time to do something ?
-  if (mbNoCollectingData)
+  if (mbNoCollectingData || mbNoTranslate)
     return;
 
   // remove any newline

Modified: openoffice/branches/l10n40/main/l10ntools/source/gHandler.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/l10ntools/source/gHandler.cxx?rev=1516418&r1=1516417&r2=1516418&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/l10ntools/source/gHandler.cxx (original)
+++ openoffice/branches/l10n40/main/l10ntools/source/gHandler.cxx Thu Aug 22 11:32:50 2013
@@ -271,7 +271,7 @@ void handler::runExtract()
   for (std::vector<std::string>::iterator siSource = mvSourceFiles.begin(); siSource
!= mvSourceFiles.end(); ++siSource)
   {
     // tell system
-    l10nMem::showDebug("gLang extracting text from file " + msSourceDir + *siSource);
+    l10nMem::showDebug("genLang extracting text from file " + msSourceDir + *siSource);
 
     // get converter and extract file
     convert_gen convertObj(mcMemory, msSourceDir, msTargetDir, *siSource);
@@ -279,7 +279,7 @@ void handler::runExtract()
   }
 
   // and generate language file
-  mcMemory.save(msPoOutDir, false, mbForceSave);
+  mcMemory.save(msPoOutDir, false, true, mbForceSave);
 }
 
 
@@ -291,7 +291,7 @@ void handler::runMerge(bool bKid)
   for (std::vector<std::string>::iterator siSource = mvSourceFiles.begin(); siSource
!= mvSourceFiles.end(); ++siSource)
   {
     // tell system
-    l10nMem::showDebug("gLang extracting text from file " + msSourceDir + *siSource);
+    l10nMem::showDebug("genLang extracting text from file " + msSourceDir + *siSource);
 
     // get converter and extract file
     convert_gen convertObj(mcMemory, msSourceDir, msTargetDir, *siSource);
@@ -299,7 +299,7 @@ void handler::runMerge(bool bKid)
   }
 
   // and generate language file
-  mcMemory.save(msPoOutDir, bKid, mbForceSave);
+  mcMemory.save(msPoOutDir, bKid, false, mbForceSave);
 }
 
 
@@ -319,7 +319,7 @@ void handler::runConvert()
       std::string sFilePath = msSourceDir + *siLang + "/";
 
         // tell system
-      l10nMem::showDebug("gLang convert text from file " + sFilePath + *siSource);
+      l10nMem::showDebug("genLang convert text from file " + sFilePath + *siSource);
 
       // get converter and extract files
       convert_gen convertObj(mcMemory, sFilePath, msTargetDir, *siSource);
@@ -328,7 +328,7 @@ void handler::runConvert()
   }
 
   // and generate language file
-  mcMemory.save(msPoOutDir, false, mbForceSave);
+  mcMemory.save(msPoOutDir, false, false, mbForceSave);
 }
 
 
@@ -426,7 +426,7 @@ void handler::showManual()
     "     comma separated string with langauge id to be used\n"
     "\n"   
     "  -d\n"
-    "     extensive verbose mode, tells what gLang is doing in detail\n"
+    "     extensive verbose mode, tells what genLang is doing in detail\n"
     "  -f <files>\n"
     "     list of files containing messages to be extracted\n"
     "     \"convert\" expect sdf generated po files, to be converted\n"
@@ -443,7 +443,7 @@ void handler::showManual()
     "  -t <target dir>\n"
     "     <directory> used to write merged source files (root path for <files>\n"
     "  -v\n"
-    "     verbose mode, tells what gLang is doing\n";
+    "     verbose mode, tells what genLang is doing\n";
 
   exit(0);
 }
@@ -460,7 +460,7 @@ void handler::loadL10MEM()
   // load texts from en-US po file (master)
   {
     // tell system
-    l10nMem::showDebug("gLang loading master text from file " + sLoad + sMod);
+    l10nMem::showDebug("genLang loading master text from file " + sLoad + sMod);
 
     // and load file
     mcMemory.setLanguage("", true, false);
@@ -476,7 +476,7 @@ void handler::loadL10MEM()
     mcMemory.setLanguage(*siLang, true, false);
 
     // tell system
-    l10nMem::showDebug("gLang loading text from language file " + sLoad + sMod);
+    l10nMem::showDebug("genLang loading text from language file " + sLoad + sMod);
 
     convert_gen(mcMemory, sLoad, msTargetDir, sMod).execute(false);
   }

Modified: openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.cxx?rev=1516418&r1=1516417&r2=1516418&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.cxx (original)
+++ openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.cxx Thu Aug 22 11:32:50 2013
@@ -93,8 +93,8 @@ void l10nMem::loadEntryKey(int iL, const
      { l10nMem_impl::mcImpl->loadEntryKey(iL, sS, sK, sO, sT, bI); }
 void l10nMem::setSourceKey(int iL, const std::string& sF, const std::string& sK,
const std::string& sT)
      { l10nMem_impl::mcImpl->setSourceKey(iL, sF, sK, sT); }
-void l10nMem::save(const std::string& sT, bool bK, bool bF)
-     { l10nMem_impl::mcImpl->save(*this, sT, bK, bF); }
+void l10nMem::save(const std::string& sT, bool bK, bool bP, bool bF)
+     { l10nMem_impl::mcImpl->save(*this, sT, bK, bP, bF); }
 int  l10nMem::prepareMerge()
      { return l10nMem_impl::mcImpl->mcDb.prepareMerge(); }
 void l10nMem::dumpMem(const std::string& sT)
@@ -226,12 +226,13 @@ void l10nMem_impl::setSourceKey(int     
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
-void l10nMem_impl::save(l10nMem& cMem, const std::string& sTargetDir, bool bKid,
bool bForce)
+void l10nMem_impl::save(l10nMem& cMem, const std::string& sTargetDir, bool bKid,
bool bPOT, bool bForce)
 {
   int iE, iEsize  = mcDb.mcENUSlist.size();
   int iL, iLsize  = mcDb.mcLangList.size();
   int iCntDeleted = 0, iCntChanged = 0, iCntAdded = 0;
-  std::string sFileName = msModuleName + ".po";
+  std::string sFileName = msModuleName + (bPOT ? ".pot" : ".po");
+ 
 
   // and reorganize db if needed
   mcDb.reorganize();
@@ -246,7 +247,7 @@ void l10nMem_impl::save(l10nMem& cMem, c
   {
     convert_gen savePo(cMem, sTargetDir, sTargetDir, sFileName);
 
-    savePo.startSave("en-US", sFileName);
+    savePo.startSave("", sFileName);
     for (iE = 1; iE < iEsize; ++iE)
     {
       l10nMem_enus_entry& cE = mcDb.mcENUSlist[iE];
@@ -255,7 +256,7 @@ void l10nMem_impl::save(l10nMem& cMem, c
       if (cE.meState == l10nMem::ENTRY_DELETED)
         continue;
 
-      savePo.save(mcDb.mcFileList[cE.miFileInx].msFileName, cE.msKey, cE.msText, cE.msText,
false);
+      savePo.save(mcDb.mcFileList[cE.miFileInx].msFileName, cE.msKey, cE.msText, "", false);
     }
     savePo.endSave();
   }
@@ -265,7 +266,7 @@ void l10nMem_impl::save(l10nMem& cMem, c
   {
     convert_gen savePo(cMem, sTargetDir, sTargetDir, sFileName);
 
-    savePo.startSave(mcDb.mcLangList[iL], sFileName);
+    savePo.startSave(mcDb.mcLangList[iL] + "/", sFileName);
     for (iE = 1; iE < iEsize; ++iE)
     {
       l10nMem_enus_entry& cE = mcDb.mcENUSlist[iE];

Modified: openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.hxx?rev=1516418&r1=1516417&r2=1516418&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.hxx (original)
+++ openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.hxx Thu Aug 22 11:32:50 2013
@@ -165,6 +165,7 @@ class l10nMem_impl
     void save         (l10nMem& cMem,
                        const std::string& sTargetDir,
                        bool               bKid,
+                       bool               bPOT,
                        bool               bForce);
     void dumpMem      (const std::string& sTargetDir);
 

Modified: openoffice/branches/l10n40/main/l10ntools/source/gLang.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/l10ntools/source/gLang.hxx?rev=1516418&r1=1516417&r2=1516418&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/l10ntools/source/gLang.hxx (original)
+++ openoffice/branches/l10n40/main/l10ntools/source/gLang.hxx Thu Aug 22 11:32:50 2013
@@ -84,6 +84,7 @@ class l10nMem
 
     void save          (const std::string& sTargetDir,
                         bool               bKid,
+                        bool               bPOT,
                         bool               bForce);
     void dumpMem       (const std::string& sTargetDir);
 



Mime
View raw message