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

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


 l10ntools/source/po.cxx |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

New commits:
commit 8d4e12a4153868c9d98937d49c4ac6064013a8dd
Author:     Andras Timar <andras.timar at collabora.com>
AuthorDate: Sun Sep 30 12:53:48 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Sep 30 21:57:24 2018 +0200

    pocheck: do not change msgctxt when po is regenerated
    
    Change-Id: I220fce194813f783c807c23eeffd2421cadd7636
    Reviewed-on: https://gerrit.libreoffice.org/61163
    Tested-by: Jenkins
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx
index c80249ad9e83..ea52d8d8a66f 100644
--- a/l10ntools/source/po.cxx
+++ b/l10ntools/source/po.cxx
@@ -141,7 +141,7 @@ void GenPoEntry::writeToFile(std::ofstream& rOFStream) const
         rOFStream << "#, c-format" << std::endl;
     if ( !m_sMsgCtxt.isEmpty() )
         rOFStream << "msgctxt "
-                  << lcl_GenMsgString(m_sReference+"\n"+m_sMsgCtxt)
+                  << lcl_GenMsgString(m_sMsgCtxt)
                   << std::endl;
     rOFStream << "msgid "
               << lcl_GenMsgString(m_sMsgId) << std::endl;
@@ -200,10 +200,7 @@ void GenPoEntry::readFromFile(std::ifstream& rIFStream)
         }
         else if (sLine.startsWith("\"") && pLastMsg)
         {
-            if (pLastMsg != &m_sMsgCtxt || sLine != "\"" + m_sReference + "\\n\"")
-            {
-                *pLastMsg += lcl_GenNormString(sLine);
-            }
+            *pLastMsg += lcl_GenNormString(sLine);
         }
         else
             break;
@@ -234,9 +231,11 @@ PoEntry::PoEntry(
         throw WRONGHELPTEXT;
 
     m_pGenPo.reset( new GenPoEntry() );
-    m_pGenPo->setReference(rSourceFile.copy(rSourceFile.lastIndexOf('/')+1));
+    OString sReference = rSourceFile.copy(rSourceFile.lastIndexOf('/')+1);
+    m_pGenPo->setReference(sReference);
 
     OString sMsgCtxt =
+        sReference + "\n" +
         rGroupId + "\n" +
         (rLocalId.isEmpty() ? OString() : rLocalId + "\n") +
         rResType;
commit 86919365393a0c3da9c86f63099bc05cb2e39844
Author:     Andras Timar <andras.timar at collabora.com>
AuthorDate: Sun Sep 30 12:14:19 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Sep 30 21:57:10 2018 +0200

    pocheck: handle the '#, c-format' flag
    
    Change-Id: I7d1d344e79e0c23886a21032d2ce85e5abb199cb
    Reviewed-on: https://gerrit.libreoffice.org/61162
    Tested-by: Jenkins
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx
index 72644095c8f8..c80249ad9e83 100644
--- a/l10ntools/source/po.cxx
+++ b/l10ntools/source/po.cxx
@@ -35,6 +35,7 @@ private:
     OString    m_sMsgId;
     OString    m_sMsgStr;
     bool       m_bFuzzy;
+    bool       m_bCFormat;
     bool       m_bNull;
 
 public:
@@ -119,6 +120,7 @@ GenPoEntry::GenPoEntry()
     , m_sMsgId( OString() )
     , m_sMsgStr( OString() )
     , m_bFuzzy( false )
+    , m_bCFormat( false )
     , m_bNull( false )
 {
 }
@@ -135,6 +137,8 @@ void GenPoEntry::writeToFile(std::ofstream& rOFStream) const
         rOFStream << "#: " << m_sReference << std::endl;
     if ( m_bFuzzy )
         rOFStream << "#, fuzzy" << std::endl;
+    if ( m_bCFormat )
+        rOFStream << "#, c-format" << std::endl;
     if ( !m_sMsgCtxt.isEmpty() )
         rOFStream << "msgctxt "
                   << lcl_GenMsgString(m_sReference+"\n"+m_sMsgCtxt)
@@ -175,6 +179,10 @@ void GenPoEntry::readFromFile(std::ifstream& rIFStream)
         {
             m_bFuzzy = true;
         }
+        else if (sLine.startsWith("#, c-format"))
+        {
+            m_bCFormat = true;
+        }
         else if (sLine.startsWith("msgctxt "))
         {
             m_sMsgCtxt = lcl_GenNormString(sLine.copy(8));


More information about the Libreoffice-commits mailing list