From 011d09f618d890deffaeb79401690895bfbfaa92 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 10 Feb 2016 20:31:26 +0300 Subject: Ignore fuzzy translations in poparser. --- src/utils/translation/poparser.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/utils/translation/poparser.cpp') diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp index d5933fbde..c2bd3e679 100644 --- a/src/utils/translation/poparser.cpp +++ b/src/utils/translation/poparser.cpp @@ -37,7 +37,8 @@ PoParser::PoParser() : mMsgStr(), mDict(nullptr), mReadingId(false), - mReadingStr(false) + mReadingStr(false), + mSkipId(false) { } @@ -163,11 +164,24 @@ bool PoParser::readMsgId() // check line start from msgid " if (strStartWith(mLine, msgId1)) { - mReadingId = true; - const size_t msgId1Size = msgId1.size(); - // reading text from: msgid "text" - mMsgId.append(mLine.substr(msgId1Size, - mLine.size() - 1 - msgId1Size)); + if (!mSkipId) + { // translation not fuzzed and can be processed + mReadingId = true; + const size_t msgId1Size = msgId1.size(); + // reading text from: msgid "text" + mMsgId.append(mLine.substr(msgId1Size, + mLine.size() - 1 - msgId1Size)); + } + else + { // skipped fuzzed translation. reset skip flag + mSkipId = false; + } + mLine.clear(); + return true; + } + else if (mLine == "#, fuzzy") + { // check for fuzzy translation + mSkipId = true; mLine.clear(); return true; } -- cgit v1.2.3-60-g2f50