openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1457588 - in /openoffice/branches/l10n/main: l10ntools/source/ sc/source/ui/src/
Date Sun, 17 Mar 2013 23:24:58 GMT
Author: jani
Date: Sun Mar 17 23:24:58 2013
New Revision: 1457588

URL: http://svn.apache.org/r1457588
Log:
update with last bugs solved, ready for merge testing

Modified:
    openoffice/branches/l10n/main/l10ntools/source/gCon.cxx
    openoffice/branches/l10n/main/l10ntools/source/gCon.hxx
    openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx
    openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx
    openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx
    openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx
    openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx
    openoffice/branches/l10n/main/l10ntools/source/gL10nMemDB.cxx
    openoffice/branches/l10n/main/l10ntools/source/gLang.hxx
    openoffice/branches/l10n/main/sc/source/ui/src/autofmt.src

Modified: openoffice/branches/l10n/main/l10ntools/source/gCon.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gCon.cxx?rev=1457588&r1=1457587&r2=1457588&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gCon.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gCon.cxx Sun Mar 17 23:24:58 2013
@@ -30,9 +30,6 @@
 #include "gConXhp.hxx"
 #include "gConXrm.hxx"
 
-#include <iostream>
-#include <fstream>
-
 
 
 /*****************************************************************************
@@ -50,7 +47,10 @@ convert_gen_impl * convert_gen_impl::mcI
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
-convert_gen::convert_gen(l10nMem& cMemory, const std::string& sSourceDir,  const
std::string& sSourceFile) 
+convert_gen::convert_gen(l10nMem&           cMemory,
+                         const std::string& sSourceDir,
+                         const std::string& sTargetDir,
+                         const std::string& sSourceFile) 
 {
   // do we have an old object
   if (convert_gen_impl::mcImpl)
@@ -77,6 +77,7 @@ convert_gen::convert_gen(l10nMem& cMemor
 
   // and set environment
   convert_gen_impl::mcImpl->msSourceFile = sSourceFile;
+  convert_gen_impl::mcImpl->msTargetPath = sTargetDir;
   convert_gen_impl::mcImpl->msSourcePath = sSourceDir + sSourceFile;
 }
 
@@ -91,12 +92,12 @@ convert_gen::~convert_gen()
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
-bool convert_gen::execute(const bool bMerge, const bool bAllowNoFile)
+bool convert_gen::execute(const bool bMerge, const bool bLoadMode, const bool bAllowNoFile)
 {
   convert_gen_impl::mcImpl->mbMergeMode  = bMerge;
 
   // and load file
-  if (!convert_gen_impl::mcImpl->prepareFile(bAllowNoFile))
+  if (!convert_gen_impl::mcImpl->prepareFile(bLoadMode, bAllowNoFile))
     return false;
 
   // and execute conversion
@@ -108,19 +109,16 @@ bool convert_gen::execute(const bool bMe
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
-void convert_gen::startSave(const std::string& sTargetDir,
-                            const std::string& sLanguage,
+void convert_gen::startSave(const std::string& sLanguage,
                             const std::string& sFile)
 {
-  convert_gen_impl::mcImpl->startSave(sTargetDir, sLanguage, sFile);
+  convert_gen_impl::mcImpl->startSave(sLanguage, sFile);
 }
-void convert_gen_impl::startSave(const std::string& sTargetDir,
-                                 const std::string& sLanguage,
+void convert_gen_impl::startSave(const std::string& sLanguage,
                                  const std::string& sFile)
 {
   std::string x;
 
-  x = sTargetDir;
   x = sLanguage;
   x = sFile;
   throw l10nMem::showError("startSave called with non .po file");
@@ -184,7 +182,7 @@ convert_gen_impl::~convert_gen_impl()
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
-bool convert_gen_impl::prepareFile(bool bAllowNoFile)
+bool convert_gen_impl::prepareFile(bool bLoadMode, bool bAllowNoFile)
 {
   std::ifstream inputFile(msSourcePath.c_str(), std::ios::binary);
 
@@ -197,7 +195,7 @@ bool convert_gen_impl::prepareFile(bool 
       return false;
     }
     else
-      throw l10nMem::showError("Cannot open file (" + msSourcePath + ")");
+      throw l10nMem::showError("Cannot open file (" + msSourcePath + ") for reading");
   }
 
   // get length of file:
@@ -211,6 +209,19 @@ bool convert_gen_impl::prepareFile(bool 
   if ((unsigned int)inputFile.gcount() != msSourceBuffer.size())
     throw l10nMem::showError("cannot read whole file");
   inputFile.close();
+
+  if (mbMergeMode && !bLoadMode)
+  {
+    // close previous file
+    if (outputFile.is_open())
+      outputFile.close();
+
+    // open output file
+    outputFile.open((msTargetPath+msSourceFile).c_str(), std::ios::binary); 
+    if (!outputFile.is_open())
+      throw l10nMem::showError("Cannot open file (" + msTargetPath+msSourceFile + ") for
writing");
+  }
+
   return true;
 }
 
@@ -252,7 +263,7 @@ void convert_gen_impl::writeSourceFile(c
   if (!line.size())
     return;
 
-  throw l10nMem::showError("writeSourceFile not implemented");
+  outputFile.write(line.c_str(), line.size());
 }
 
 

Modified: openoffice/branches/l10n/main/l10ntools/source/gCon.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gCon.hxx?rev=1457588&r1=1457587&r2=1457588&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gCon.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gCon.hxx Sun Mar 17 23:24:58 2013
@@ -22,6 +22,9 @@
 #define GCON_HXX
 #include "gLang.hxx"
 
+#include <iostream>
+#include <fstream>
+
 
 
 /*****************************************************************************
@@ -51,8 +54,7 @@ class convert_gen_impl
     virtual void execute() = 0;
 
     // ONLY po should implement these functions
-    virtual void startSave(const std::string& sTargetDir,
-                           const std::string& sLanguage,
+    virtual void startSave(const std::string& sLanguage,
                            const std::string& sFile);
     virtual void save(const std::string& sFileName,
                       const std::string& sKey,
@@ -64,6 +66,7 @@ class convert_gen_impl
     // generic variables
     bool         mbMergeMode;
     std::string  msSourcePath;
+    std::string  msTargetPath;
     std::string  msSourceFile;
     l10nMem&     mcMemory;
     std::string  msCollector;
@@ -79,8 +82,10 @@ class convert_gen_impl
     std::string  msSourceBuffer, msCopyText;
     int          miSourceReadIndex;
 
-    bool prepareFile(bool bAllowNoFile);
+    bool prepareFile(bool bLoadMode, bool bAllowNoFile);
 
+  private:
+    std::ofstream outputFile;
 
     friend class convert_gen;
 };

Modified: openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx?rev=1457588&r1=1457587&r2=1457588&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx Sun Mar 17 23:24:58 2013
@@ -62,8 +62,7 @@ class convert_po : public convert_gen_im
 
     void execute();
 
-    void startSave(const std::string& sTargetDir,
-                   const std::string& sLanguage,
+    void startSave(const std::string& sLanguage,
                    const std::string& sFile);
     void save(const std::string& sFileName,
               const std::string& sKey,

Modified: openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx?rev=1457588&r1=1457587&r2=1457588&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx Sun Mar 17 23:24:58 2013
@@ -164,11 +164,10 @@ void convert_po::execute()
  
  
 /**********************   I M P L E M E N T A T I O N   **********************/
-void convert_po::startSave(const std::string& sTargetDir,
-                           const std::string& sLanguage,
+void convert_po::startSave(const std::string& sLanguage,
                            const std::string& sFile)
 {
-  std::string sFilePath = sTargetDir + sLanguage + "/" + sFile;
+  std::string sFilePath = msTargetPath + sLanguage + "/" + sFile;
   outBuffer.open(sFilePath.c_str(), std::ios::out);
 
   if (!outBuffer.is_open())

Modified: openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx?rev=1457588&r1=1457587&r2=1457588&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx Sun Mar 17 23:24:58 2013
@@ -73,9 +73,6 @@ void convert_xhp::execute()
 /**********************   I M P L E M E N T A T I O N   **********************/
 void convert_xhp::setString(char *yytext)
 {
-  if (meExpectValue == VALUE_IS_VALUE_TAG)
-    msCollector += "\\";
-
   copySourceWithCollector(yytext);
 }
 
@@ -142,10 +139,6 @@ void convert_xhp::setId(char *yytext)
          break;
 
     case VALUE_IS_VALUE_TAG:
-         msCollector.insert(nX + nE, "\\");
-         msCollector.insert(nX + nL, "\\");
-         break;
-
     case VALUE_NOT_USED:
     case VALUE_IS_VALUE:
          break;
@@ -210,10 +203,6 @@ void convert_xhp::setRef(char *yytext)
          break;
 
     case VALUE_IS_VALUE_TAG:
-         msCollector.insert(nX + nE, "\\");
-         msCollector.insert(nX + nL, "\\");
-         break;
-
     case VALUE_NOT_USED:
     case VALUE_IS_VALUE:
          break;

Modified: openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx?rev=1457588&r1=1457587&r2=1457588&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx Sun Mar 17 23:24:58 2013
@@ -200,6 +200,12 @@ void handler::checkCommandLine(int argc,
   nLen = msSourceDir.size();
   if (nLen && msSourceDir.at(nLen-1) != '/')
     msSourceDir.append("/");
+  nLen = msTargetDir.find("/help_");
+  if (nLen != (int)std::string::npos)
+  {
+    msTargetDir.erase(nLen+1);
+    msTargetDir.append("helpcontent2");
+  }
   nLen = msTargetDir.size();
   if (nLen && msTargetDir.at(nLen-1) != '/')
     msTargetDir.append("/");
@@ -271,8 +277,8 @@ void handler::runExtractMerge(bool bMerg
     l10nMem::showDebug("gLang extracting text from file " + msSourceDir + *siSource);
 
     // get converter and extract file
-    convert_gen convertObj(mcMemory, msSourceDir, *siSource);
-    convertObj.execute(bMerge, false);
+    convert_gen convertObj(mcMemory, msSourceDir, msTargetDir, *siSource);
+    convertObj.execute(bMerge, false, false);
 
     //JIX runExtractMerge, handle merge
   }
@@ -301,8 +307,8 @@ void handler::runConvert()
       l10nMem::showDebug("gLang convert text from file " + sFilePath + *siSource);
 
       // get converter and extract files
-      convert_gen convertObj(mcMemory, sFilePath, *siSource);
-      convertObj.execute(true, true);
+      convert_gen convertObj(mcMemory, sFilePath, msTargetDir, *siSource);
+      convertObj.execute(true, true, true);
     }
   }
 
@@ -448,7 +454,7 @@ void handler::loadL10MEM()
 
     // and load file
     mcMemory.setLanguage("", true, false);
-    convert_gen (mcMemory, sLoad, sMod).execute(false, true);
+    convert_gen (mcMemory, sLoad, msTargetDir, sMod).execute(false, true, true);
   }
 
   // loop through all languages and load text
@@ -462,7 +468,7 @@ void handler::loadL10MEM()
     // tell system
     l10nMem::showDebug("gLang loading text from language file " + sLoad + sMod);
 
-    convert_gen(mcMemory, sLoad, sMod).execute(false, true);
+    convert_gen(mcMemory, sLoad, msTargetDir, sMod).execute(false, true, true);
   }
 }
 

Modified: openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx?rev=1457588&r1=1457587&r2=1457588&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx Sun Mar 17 23:24:58 2013
@@ -189,12 +189,22 @@ void l10nMem_impl::setSourceKey(int     
   int         i;
 
 
-  // time to escape " if contained in text or key
+  // time to escape " and \ if contained in text or key
+  for (i = 0; (i = newText.find("\\", i)) != (int)std::string::npos;)
+  {
+    ++i;
+    if (i < (int)newText.size() && (newText[i] == '<' || newText[i] == '>'))
+      ++i;
+    else
+    {
+      newText.insert(i-1, "\\");
+      ++i;
+    }
+  }
   for (i = 0; (i = newText.find("\"", i)) != (int)std::string::npos;)
   {
-    if (!i || newText[i-1] != '\\' || (newText[i-1] == '\\' &&  newText[i-2] == '\\'))
-      newText.insert(i++, "\\");
-    i++;
+    newText.insert(i, "\\");
+    i += 2;
   }
 
   // if key exist update state
@@ -230,9 +240,9 @@ void l10nMem_impl::save(l10nMem& cMem, c
 
   // Save en_US
   {
-    convert_gen savePo(cMem, sTargetDir, sFileName);
+    convert_gen savePo(cMem, sTargetDir, sTargetDir, sFileName);
 
-    savePo.startSave(sTargetDir, "en_US", sFileName);
+    savePo.startSave("en_US", sFileName);
     for (iE = 1; iE < iEsize; ++iE)
     {
       l10nMem_enus_entry& cE     = mcDb.mcENUSlist[iE];
@@ -249,9 +259,9 @@ void l10nMem_impl::save(l10nMem& cMem, c
   // save all languages
   for (iL = 1; iL < iLsize; ++iL)
   {
-    convert_gen savePo(cMem, sTargetDir, sFileName);
+    convert_gen savePo(cMem, sTargetDir, sTargetDir, sFileName);
 
-    savePo.startSave(sTargetDir, 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/l10n/main/l10ntools/source/gL10nMemDB.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gL10nMemDB.cxx?rev=1457588&r1=1457587&r2=1457588&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gL10nMemDB.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gL10nMemDB.cxx Sun Mar 17 23:24:58 2013
@@ -371,6 +371,7 @@ void l10nMem_db::addKey(int             
 
     // file is registred, so we need to add the entry at the end of the file range
     curF.miEnd++;
+    miCurENUSinx = curF.miEnd;
     mcENUSlist.insert(it + curF.miEnd,
                       l10nMem_enus_entry(sKey, sText, iLineNo, miCurFileInx,
                                          mcLangList.size(), eStat));

Modified: openoffice/branches/l10n/main/l10ntools/source/gLang.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gLang.hxx?rev=1457588&r1=1457587&r2=1457588&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gLang.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gLang.hxx Sun Mar 17 23:24:58 2013
@@ -95,15 +95,19 @@ class l10nMem
 class convert_gen
 {
   public:
-    convert_gen(l10nMem& cMemory, const std::string& sSourceDir, const std::string&
sSourceFile);
+    convert_gen(l10nMem&           cMemory,
+                const std::string& sSourceDir,
+                const std::string& sTargetDir,
+                const std::string& sSourceFile);
     ~convert_gen();
 
     // do extract/merge
-    bool execute(const bool bMerge, const bool bAllowNoFile);
+    bool execute(const bool         bMerge,
+                 const bool         bLoadMode,
+                 const bool         bAllowNoFile);
 
     // ONLY po should implement these functions
-    void startSave(const std::string& sTargetDir,
-                   const std::string& sLanguage,
+    void startSave(const std::string& sLanguage,
                    const std::string& sFile);
     void save(const std::string& sFileName,
               const std::string& sKey,

Modified: openoffice/branches/l10n/main/sc/source/ui/src/autofmt.src
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/sc/source/ui/src/autofmt.src?rev=1457588&r1=1457587&r2=1457588&view=diff
==============================================================================
--- openoffice/branches/l10n/main/sc/source/ui/src/autofmt.src (original)
+++ openoffice/branches/l10n/main/sc/source/ui/src/autofmt.src Sun Mar 17 23:24:58 2013
@@ -197,7 +197,7 @@ ModalDialog RID_SCDLG_AUTOFORMAT
 	String STR_DEL_MSG
 	{
 		/* ### ACHTUNG: Neuer Text in Resource? Wollen Sie das AutoFormat # wirklich löschen?
: Wollen Sie das AutoFormat # wirklich l÷schen? */
-		Text [ en-US ] = "Do you really want to delete the # AutoFomat?" ;
+		Text [ en-US ] = "Do you really want to delete the # AutoFormat?" ;
 	};
 	String STR_BTN_CLOSE
 	{



Mime
View raw message