You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ja...@apache.org on 2013/03/15 23:55:53 UTC

svn commit: r1457156 - in /openoffice/branches/l10n/main/l10ntools/source: gConPo.hxx gConPoWrap.cxx gConPolex.l gL10nMem.cxx

Author: jani
Date: Fri Mar 15 22:55:53 2013
New Revision: 1457156

URL: http://svn.apache.org/r1457156
Log:
final convert !!

Modified:
    openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx
    openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx
    openoffice/branches/l10n/main/l10ntools/source/gConPolex.l
    openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx

Modified: openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx?rev=1457156&r1=1457155&r2=1457156&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx Fri Mar 15 22:55:53 2013
@@ -45,13 +45,13 @@ class convert_po : public convert_gen_im
     convert_po(l10nMem& crMemory);
     ~convert_po();
 
-    void startLook (char *syyText);
+    void startLook ();
     void setValue  (char *syyText, int iLineCnt);
-    void setFuzzy  (char *syyText);
+    void setFuzzy  ();
     void setKey    (char *syyText);
-    void setMsgId  (char *syyText);
-    void setMsgStr (char *syyText);
-    void handleNL  (char *syyText);
+    void setMsgId  ();
+    void setMsgStr ();
+    void handleNL  ();
 
   private:
     std::string  msId;

Modified: openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx?rev=1457156&r1=1457155&r2=1457156&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx Fri Mar 15 22:55:53 2013
@@ -62,13 +62,12 @@ namespace PoWrap
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
-void convert_po::startLook(char *syyText)
+void convert_po::startLook()
 {
  std::string sFileName, sNewKey;
  int         i;
 
 
- handleNL(syyText);
  if (!msKey.size() || !msId.size() || !msStr.size())
     return;
 
@@ -103,10 +102,8 @@ void convert_po::setValue(char *syyText,
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
-void convert_po::setFuzzy(char *syyText)
+void convert_po::setFuzzy()
 {
-  std::string sText(syyText);
-
   mbFuzzy = true;
 }
 
@@ -118,6 +115,10 @@ void convert_po::setKey(char *syyText)
   int i;
 
 
+  // Activate "look for msg" mode.
+  startLook();
+
+
   // skip "#:" and any blanks
   for (syyText += 2; *syyText == ' ' || *syyText == '\t'; ++syyText) ;
   msKey = syyText;
@@ -125,40 +126,29 @@ void convert_po::setKey(char *syyText)
   // remove trailing blanks
   for (i = msKey.size() -1; msKey[i] == '\r' || msKey[i] == ' ' || msKey[i] == '\t'; --i) ;
   msKey.erase(i+1);
-
-  if (msKey == "macrodlg.src#RID_MACROCHOOSER.modaldialog.text")
-  {
-    msKey = "jan";
-  }
 }
 
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
-void convert_po::setMsgId(char *syyText)
+void convert_po::setMsgId()
 {
-  std::string sText(syyText);
-
   mbExpectId = true;
 }
 
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
-void convert_po::setMsgStr(char *syyText)
+void convert_po::setMsgStr()
 {
-  std::string sText(syyText);
-
   mbExpectStr = true;
 }
 
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
-void convert_po::handleNL(char *syyText)
+void convert_po::handleNL()
 {
-  mbExpectId  =
-  mbExpectStr = false;
   ++miLineNo;
 }
 
@@ -168,7 +158,7 @@ void convert_po::handleNL(char *syyText)
 void convert_po::execute()
 {
   PoWrap::yylex();
-  startLook("");
+  startLook();
 }
 
  

Modified: openoffice/branches/l10n/main/l10ntools/source/gConPolex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConPolex.l?rev=1457156&r1=1457155&r2=1457156&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConPolex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConPolex.l Fri Mar 15 22:55:53 2013
@@ -76,33 +76,33 @@ SPACE [ \t]*
 
 
 "\"" {
-  if (LOCptr->mbExpectId || LOCptr->mbExpectStr)
+  char buildValue[8000];
+  int j, i, iLineCnt;
+
+  // loop across multiple "..." and combine them, while keeping the source
+  for (j = -1, iLineCnt = i = 0; yytext[i] == '\"';)
   {
-    char buildValue[8000];
-    int j, i, iLineCnt;
+    // build current "..."
+    for (; (buildValue[++j] = yytext[++i] = yyinput()) != '\"';)
+      if (yytext[i] == '\\')
+      {
+        if ( (yytext[++i] = yyinput()) != '\"')
+          ++j;
+        buildValue[j] = yytext[i];
+      }
+    --j;
 
-    // loop across multiple "..." and combine them, while keeping the source
-    for (j = -1, iLineCnt = i = 0; yytext[i] == '\"';)
-    {
-      // build current "..."
-      for (; (buildValue[++j] = yytext[++i] = yyinput()) != '\"';)
-        if (yytext[i] == '\\')
-        {
-          yytext[++i] = yyinput();
-          if (yytext[i] != '\"')
-            ++j;
-          buildValue[j] = yytext[i];
-        }
-      --j;
+    if (!LOCptr->mbExpectId && !LOCptr->mbExpectStr)
+      break;
 
-      // skip until next line
-      for (; (yytext[++i] = yyinput()) != '\n' && yytext[i] != '\"' && yytext[i] != EOF;) ;
+    // skip rest of line
+    for (; (yytext[++i] = yyinput()) == ' ' || yytext[i] == '\t' || yytext[i] == '\n';)
       if (yytext[i] == '\n')
-      {
         ++iLineCnt;
-        yytext[++i] = yyinput();
-      }
-    }
+  }
+
+  if (LOCptr->mbExpectId || LOCptr->mbExpectStr)
+  {
     if (yytext[i] != EOF)
     {
       unput(yytext[i]);
@@ -113,39 +113,36 @@ SPACE [ \t]*
 }
 
 
-^"#,"{SPACE}.*[fF][uU][zZ][zZ][yY] {
-  LOCptr->setFuzzy(yytext);
+"#,"{SPACE}.*[fF][uU][zZ][zZ][yY] {
+  LOCptr->setFuzzy();
 }
 
 
-^"#:".* {
+"#:".* {
   LOCptr->setKey(yytext);
 }
 
 
-^"#~".* {
+[mM][sS][gG][cC][tT][xX][tT].* |
+"#*".*                         |
+"# ".*                         |
+"#~".*                         {
   // special comment, just skip
-  LOCptr->setMsgStr(yytext);
 }
 
 
-^[mM][sS][gG][iI][dD]{SPACE} {
-  LOCptr->setMsgId(yytext);
+[mM][sS][gG][iI][dD]{SPACE} {
+  LOCptr->setMsgId();
 }
 
 
-^[mM][sS][gG][sS][tT][rR]{SPACE} {
-  LOCptr->setMsgStr(yytext);
-}
-
-
-\n\r*\n {
-  LOCptr->startLook(yytext);
+[mM][sS][gG][sS][tT][rR]{SPACE} {
+  LOCptr->setMsgStr();
 }
 
 
 \n {
-  LOCptr->handleNL(yytext);
+  LOCptr->handleNL();
 }
 
 

Modified: openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx?rev=1457156&r1=1457155&r2=1457156&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx Fri Mar 15 22:55:53 2013
@@ -396,13 +396,13 @@ void l10nMem_impl::convEntryKey(int     
   iSize = ivEntryList.size();
   if (!iSize)
   {
-    showWarning("filename(" + sSourceFile + ") key(" + sKey +") lang(" +
-                mcDb.mcLangList[mcDb.miCurLangInx] + ") not found!", iLineNo);
+    showWarning("file(" + sSourceFile + ") key(" + sKey + ")  lang(" + mcDb.mcLangList[mcDb.miCurLangInx] +
+                ") with msgId(" + sOrgText + ") file not found", iLineNo);
     return;
   }
 
   // Loop through all potential en_US entries
-  for (iCandidate = i = 0; i < iSize; ++i)
+  for (iCandidate = -1, i = 0; i < iSize; ++i)
   {
     l10nMem_enus_entry& curE = mcDb.mcENUSlist[ivEntryList[i]];
 
@@ -425,21 +425,18 @@ void l10nMem_impl::convEntryKey(int     
     if (sKeyUpper != curE.msUpperKey)
       continue;
 
-    iCandidate = ivEntryList[i];
-  }
-  if (i == iSize && iCandidate <= 0)
-  {
-    showWarning("key(" + sKey + ")  lang(" + mcDb.mcLangList[mcDb.miCurLangInx] +
-                ") with msgId(" + sOrgText + ") cannot be matched", iLineNo);
+    iCandidate = i;
   }
+  sKeyUpper.clear();
+  if (i == iSize && iCandidate < 0)
+    sKeyUpper = "cannot be matched";
   else
   {
     // Primarely use text match, alternatively use key candidate 
     if (i == iSize)
     {
       i = iCandidate;
-      showDebug("matching through KEY, key(" + sKey + ")  lang(" + mcDb.mcLangList[mcDb.miCurLangInx] +
-                ") with msgId(" + sOrgText + ")", iLineNo);
+      sKeyUpper = "could only be matched through KEY";
     }
 
     // update language text
@@ -452,5 +449,10 @@ void l10nMem_impl::convEntryKey(int     
       curL.mbFuzzy = bIsFuzzy;
       curE.meState = l10nMem::ENTRY_CHANGED;
     }
+    if (sKeyUpper.size())
+    {
+      showWarning("file(" + sSourceFile + ") key(" + sKey + ")  lang(" + mcDb.mcLangList[mcDb.miCurLangInx] +
+                  ") with msgId(" + sOrgText + ") " + sKeyUpper, iLineNo);
+    }
   }
 }