[Libreoffice-commits] core.git: l10ntools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Sep 30 19:59:51 UTC 2018


 l10ntools/source/pocheck.cxx |  117 +++++--------------------------------------
 1 file changed, 16 insertions(+), 101 deletions(-)

New commits:
commit 1139c76b60b9a9f6df2bc53deb6c1c1cba42178d
Author:     Andras Timar <andras.timar at collabora.com>
AuthorDate: Sun Sep 30 17:43:26 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Sep 30 21:59:17 2018 +0200

    pocheck: tdf#119080 update po checker tool for post LO 6.0 po files
    
    Change-Id: I700eaa0d412fb609fdc89ca07003534e6bb13854

diff --git a/l10ntools/source/pocheck.cxx b/l10ntools/source/pocheck.cxx
index 2e4b1a4eb878..4f7c7686757a 100644
--- a/l10ntools/source/pocheck.cxx
+++ b/l10ntools/source/pocheck.cxx
@@ -24,7 +24,7 @@ static void checkStyleNames(const OString& aLanguage)
 
     OString aPoPath = OString(getenv("SRC_ROOT")) +
                       "/translations/source/" +
-                      aLanguage + "/sw/source/ui/utlui.po";
+                      aLanguage + "/sw/messages.po";
     PoIfstream aPoInput;
     aPoInput.open(aPoPath);
     if( !aPoInput.isOpen() )
@@ -43,8 +43,7 @@ static void checkStyleNames(const OString& aLanguage)
             break;
         }
 
-        if( !aPoEntry.isFuzzy() && aPoEntry.getSourceFile() == "poolfmt.src" &&
-            aPoEntry.getGroupId().startsWith("STR_POOLCOLL") )
+        if( !aPoEntry.isFuzzy() && aPoEntry.getMsgCtxt().startsWith("STR_POOLCOLL") )
         {
             OString aMsgStr = aPoEntry.getMsgStr();
             if( aMsgStr.isEmpty() )
@@ -56,8 +55,7 @@ static void checkStyleNames(const OString& aLanguage)
                 bRepeated = true;
             }
         }
-        if( !aPoEntry.isFuzzy() && aPoEntry.getSourceFile() == "poolfmt.src" &&
-            aPoEntry.getGroupId().startsWith("STR_POOLNUMRULE") )
+        if( !aPoEntry.isFuzzy() && aPoEntry.getMsgCtxt().startsWith("STR_POOLNUMRULE") )
         {
             OString aMsgStr = aPoEntry.getMsgStr();
             if( aMsgStr.isEmpty() )
@@ -100,7 +98,7 @@ static void checkStyleNames(const OString& aLanguage)
     }
     PoOfstream aPoOutput;
     aPoOutput.open(aPoPath+".new");
-    PoHeader aTmp("sw/source/ui/utlui");
+    PoHeader aTmp("sw/inc");
     aPoOutput.writeHeader(aTmp);
     bool bAnyError = false;
 
@@ -113,7 +111,7 @@ static void checkStyleNames(const OString& aLanguage)
             break;
         for (auto const& repeatedEntry : repeatedEntries)
         {
-            if (repeatedEntry.getMsgId() == aPoEntry.getMsgId() && repeatedEntry.getGroupId() == aPoEntry.getGroupId()) {
+            if (repeatedEntry.getMsgId() == aPoEntry.getMsgId() && repeatedEntry.getMsgCtxt() == aPoEntry.getMsgCtxt()) {
                 bError = true;
                 break;
             }
@@ -142,13 +140,13 @@ static void checkFunctionNames(const OString& aLanguage)
 
     std::vector<PoEntry> repeatedEntries;
 
-    OString aPoPaths[4];
+    OString aPoPaths[2];
     OUString aPoPathURL;
 
     aPoPaths[0] = OString(getenv("SRC_ROOT")) +
                       "/translations/source/" +
                       aLanguage +
-                      "/formula/source/core/resource.po";
+                      "/formula/messages.po";
     PoIfstream aPoInput;
     aPoInput.open(aPoPaths[0]);
     if( !aPoInput.isOpen() )
@@ -163,7 +161,7 @@ static void checkFunctionNames(const OString& aLanguage)
         aPoInput.readEntry(aPoEntry);
         if( aPoInput.eof() )
             break;
-        if( !aPoEntry.isFuzzy() && aPoEntry.getGroupId() == "RID_STRLIST_FUNCTION_NAMES" )
+        if( !aPoEntry.isFuzzy() && aPoEntry.getMsgCtxt() == "RID_STRLIST_FUNCTION_NAMES" )
         {
             OString aMsgStr = aPoEntry.getMsgStr();
             if( aMsgStr.isEmpty() )
@@ -183,7 +181,7 @@ static void checkFunctionNames(const OString& aLanguage)
     aPoPaths[1] = OString(getenv("SRC_ROOT")) +
         "/translations/source/" +
         aLanguage +
-        "/scaddins/source/analysis.po";
+        "/scaddins/messages.po";
     aPoInput.open(aPoPaths[1]);
     if( !aPoInput.isOpen() )
     {
@@ -197,7 +195,7 @@ static void checkFunctionNames(const OString& aLanguage)
         aPoInput.readEntry(aPoEntry);
         if( aPoInput.eof() )
             break;
-        if( !aPoEntry.isFuzzy() && aPoEntry.getGroupId() == "RID_ANALYSIS_FUNCTION_NAMES" )
+        if( !aPoEntry.isFuzzy() && aPoEntry.getMsgCtxt().startsWith("ANALYSIS_FUNCNAME") )
         {
             OString aMsgStr = aPoEntry.getMsgStr();
             if( aMsgStr.isEmpty() )
@@ -214,77 +212,6 @@ static void checkFunctionNames(const OString& aLanguage)
     }
     aPoInput.close();
 
-
-    aPoPaths[2] = OString(getenv("SRC_ROOT")) +
-              "/translations/source/" +
-               aLanguage +
-              "/scaddins/source/datefunc.po";
-    aPoInput.open(aPoPaths[2]);
-    if( !aPoInput.isOpen() )
-    {
-        std::cerr << "Warning: Cannot open " << aPoPaths[2] << std::endl;
-        return;
-    }
-
-    for(;;)
-    {
-        PoEntry aPoEntry;
-        aPoInput.readEntry(aPoEntry);
-        if( aPoInput.eof() )
-            break;
-        if( !aPoEntry.isFuzzy() && aPoEntry.getGroupId() == "RID_DATE_FUNCTION_NAMES" )
-        {
-            OString aMsgStr = aPoEntry.getMsgStr();
-            if( aMsgStr.isEmpty() )
-                continue;
-            if( aLocalizedCoreFunctionNames.find(aMsgStr) != aLocalizedCoreFunctionNames.end() )
-                aMsgStr += "_ADD";
-            if( aLocalizedFunctionNames.find(aMsgStr) == aLocalizedFunctionNames.end() ) {
-                aLocalizedFunctionNames[aMsgStr] = 1;
-            } else {
-                aLocalizedFunctionNames[aMsgStr]++;
-                repeatedEntries.push_back(aPoEntry);
-            }
-        }
-    }
-    aPoInput.close();
-
-    aPoPaths[3] = OString(getenv("SRC_ROOT")) +
-              "/translations/source/" +
-               aLanguage +
-              "/scaddins/source/pricing.po";
-    aPoInput.open(aPoPaths[3]);
-    if( !aPoInput.isOpen() )
-    {
-        std::cerr << "Warning: Cannot open " << aPoPaths[3] << std::endl;
-        return;
-    }
-
-    for(;;)
-    {
-        PoEntry aPoEntry;
-        aPoInput.readEntry(aPoEntry);
-        if( aPoInput.eof() )
-        {
-            break;
-        }
-
-        if( !aPoEntry.isFuzzy() && aPoEntry.getGroupId() == "RID_PRICING_FUNCTION_NAMES" )
-        {
-            OString aMsgStr = aPoEntry.getMsgStr();
-            if( aMsgStr.isEmpty() )
-                continue;
-            if( aLocalizedCoreFunctionNames.find(aMsgStr) != aLocalizedCoreFunctionNames.end() )
-                aMsgStr += "_ADD";
-            if( aLocalizedFunctionNames.find(aMsgStr) == aLocalizedFunctionNames.end() ) {
-                aLocalizedFunctionNames[aMsgStr] = 1;
-            } else {
-                aLocalizedFunctionNames[aMsgStr]++;
-                repeatedEntries.push_back(aPoEntry);
-            }
-        }
-    }
-    aPoInput.close();
     for (auto const& localizedFunctionName : aLocalizedFunctionNames)
     {
         if( localizedFunctionName.second > 1 )
@@ -297,7 +224,7 @@ static void checkFunctionNames(const OString& aLanguage)
         }
     }
 
-    for (int i=0;i<4;i++)
+    for (int i=0;i<2;i++)
     {
         aPoInput.open(aPoPaths[i]);
         if( !aPoInput.isOpen() )
@@ -309,25 +236,13 @@ static void checkFunctionNames(const OString& aLanguage)
         {
         case 0:
         {
-            PoHeader hd(OString("formula/source/core/resource"));
+            PoHeader hd(OString("formula/inc"));
             aPoOutput.writeHeader(hd);
             break;
         }
         case 1:
         {
-            PoHeader hd(OString("scaddins/source/analysis"));
-            aPoOutput.writeHeader(hd);
-            break;
-        }
-        case 2:
-        {
-            PoHeader hd(OString("scaddins/source/datefunc"));
-            aPoOutput.writeHeader(hd);
-            break;
-        }
-        case 3:
-        {
-            PoHeader hd(OString("scaddins/source/pricing"));
+            PoHeader hd(OString("scaddins/inc"));
             aPoOutput.writeHeader(hd);
             break;
         }
@@ -343,7 +258,7 @@ static void checkFunctionNames(const OString& aLanguage)
                 break;
             for (auto const& repeatedEntry : repeatedEntries)
             {
-                if (repeatedEntry.getMsgId() == aPoEntry.getMsgId() && repeatedEntry.getGroupId() == aPoEntry.getGroupId())
+                if (repeatedEntry.getMsgId() == aPoEntry.getMsgId() && repeatedEntry.getMsgCtxt() == aPoEntry.getMsgCtxt())
                 {
                     bError = true;
                     break;
@@ -429,7 +344,7 @@ static void checkMathSymbolNames(const OString& aLanguage)
     OString aPoPath = OString(getenv("SRC_ROOT")) +
                       "/translations/source/" +
                       aLanguage +
-                      "/starmath/source.po";
+                      "/starmath/messages.po";
     PoIfstream aPoInput;
     aPoInput.open(aPoPath);
     if( !aPoInput.isOpen() )
@@ -439,7 +354,7 @@ static void checkMathSymbolNames(const OString& aLanguage)
     }
     PoOfstream aPoOutput;
     aPoOutput.open(aPoPath+".new");
-    PoHeader aTmp("starmath/source");
+    PoHeader aTmp("starmath/inc");
     aPoOutput.writeHeader(aTmp);
     bool bError = false;
 


More information about the Libreoffice-commits mailing list