diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-10 20:31:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-10 20:31:26 +0300 |
commit | 011d09f618d890deffaeb79401690895bfbfaa92 (patch) | |
tree | e68321be976960c1f3d74fe9535c264b391eede7 /src/utils/translation/poparser.cpp | |
parent | dde9d0d8a9b803ed5e78797ebb5ab0db5fddf662 (diff) | |
download | plus-011d09f618d890deffaeb79401690895bfbfaa92.tar.gz plus-011d09f618d890deffaeb79401690895bfbfaa92.tar.bz2 plus-011d09f618d890deffaeb79401690895bfbfaa92.tar.xz plus-011d09f618d890deffaeb79401690895bfbfaa92.zip |
Ignore fuzzy translations in poparser.
Diffstat (limited to 'src/utils/translation/poparser.cpp')
-rw-r--r-- | src/utils/translation/poparser.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
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; } |