[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - l10ntools/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Nov 21 12:39:15 UTC 2018
l10ntools/source/po.cxx | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
New commits:
commit d223191c97098024a3b4e824c3b0f4f97cc645c8
Author: Andras Timar <andras.timar at collabora.com>
AuthorDate: Sun Sep 30 16:42:26 2018 +0200
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Nov 21 13:38:50 2018 +0100
pocheck: PO entries can have multiple source code reference lines since LO 6.0
Reviewed-on: https://gerrit.libreoffice.org/61164
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar at collabora.com>
(cherry picked from commit 1bf49e98f8019bf62906651804725e4da5b9d514)
Change-Id: Icbe0dd5e63eb5b10d162f34347ab86dde547dc62
Reviewed-on: https://gerrit.libreoffice.org/63597
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx
index f316df1bed31..8b6edd50d65d 100644
--- a/l10ntools/source/po.cxx
+++ b/l10ntools/source/po.cxx
@@ -29,7 +29,7 @@ class GenPoEntry
{
private:
OString m_sExtractCom;
- OString m_sReference;
+ std::vector<OString> m_sReferences;
OString m_sMsgCtxt;
OString m_sMsgId;
OString m_sMsgStr;
@@ -40,7 +40,7 @@ private:
public:
GenPoEntry();
- const OString& getReference() const { return m_sReference; }
+ const std::vector<OString>& getReference() const { return m_sReferences; }
const OString& getMsgCtxt() const { return m_sMsgCtxt; }
const OString& getMsgId() const { return m_sMsgId; }
const OString& getMsgStr() const { return m_sMsgStr; }
@@ -53,7 +53,7 @@ public:
}
void setReference(const OString& rReference)
{
- m_sReference = rReference;
+ m_sReferences.push_back(rReference);
}
void setMsgCtxt(const OString& rMsgCtxt)
{
@@ -114,7 +114,7 @@ namespace
GenPoEntry::GenPoEntry()
: m_sExtractCom( OString() )
- , m_sReference( OString() )
+ , m_sReferences( std::vector<OString>() )
, m_sMsgCtxt( OString() )
, m_sMsgId( OString() )
, m_sMsgStr( OString() )
@@ -132,8 +132,11 @@ void GenPoEntry::writeToFile(std::ofstream& rOFStream) const
rOFStream
<< "#. "
<< m_sExtractCom.replaceAll("\n","\n#. ") << std::endl;
- if ( !m_sReference.isEmpty() )
- rOFStream << "#: " << m_sReference << std::endl;
+ if ( !m_sReferences.empty() )
+ {
+ for(std::vector<OString>::const_iterator it = m_sReferences.begin(); it != m_sReferences.end(); ++it)
+ rOFStream << "#: " << *it << std::endl;
+ }
if ( m_bFuzzy )
rOFStream << "#, fuzzy" << std::endl;
if ( m_bCFormat )
@@ -172,7 +175,7 @@ void GenPoEntry::readFromFile(std::ifstream& rIFStream)
}
else if (sLine.startsWith("#: "))
{
- m_sReference = sLine.copy(3);
+ m_sReferences.push_back(sLine.copy(3));
}
else if (sLine.startsWith("#, fuzzy"))
{
@@ -251,7 +254,7 @@ PoEntry::PoEntry(
m_pGenPo->setMsgId(rText);
m_pGenPo->setExtractCom(
( !rHelpText.isEmpty() ? rHelpText + "\n" : OString()) +
- genKeyId( m_pGenPo->getReference() + rGroupId + rLocalId + rResType + rText ) );
+ genKeyId( m_pGenPo->getReference().front() + rGroupId + rLocalId + rResType + rText ) );
m_bIsInitialized = true;
}
@@ -300,7 +303,7 @@ PoEntry& PoEntry::operator=(PoEntry&& rPo)
OString const & PoEntry::getSourceFile() const
{
assert( m_bIsInitialized );
- return m_pGenPo->getReference();
+ return m_pGenPo->getReference().front();
}
OString PoEntry::getGroupId() const
@@ -491,7 +494,7 @@ namespace
// Check the validity of read entry
bool lcl_CheckInputEntry(const GenPoEntry& rEntry)
{
- return !rEntry.getReference().isEmpty() &&
+ return !rEntry.getReference().empty() &&
!rEntry.getMsgCtxt().isEmpty() &&
!rEntry.getMsgId().isEmpty();
}
More information about the Libreoffice-commits
mailing list