diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-01-02 19:23:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-01-02 21:35:07 +0300 |
commit | 2a9ac5ea06d22e459762295546e88d76b835f552 (patch) | |
tree | 619d93de71312c94ee7fa7bc87edb9124a676d9c /src/utils | |
parent | a65d9da124346f6cec0ac679c689bf6dd0ce34e8 (diff) | |
download | plus-2a9ac5ea06d22e459762295546e88d76b835f552.tar.gz plus-2a9ac5ea06d22e459762295546e88d76b835f552.tar.bz2 plus-2a9ac5ea06d22e459762295546e88d76b835f552.tar.xz plus-2a9ac5ea06d22e459762295546e88d76b835f552.zip |
Add basic support for skiping plurals and use default translation.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/translation/poparser.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp index ba07a490a..d5933fbde 100644 --- a/src/utils/translation/poparser.cpp +++ b/src/utils/translation/poparser.cpp @@ -120,6 +120,12 @@ bool PoParser::readLine() char line[1001]; if (!mFile.getline(line, 1000)) return false; + // skip plurals msgid if present + if (strStartWith(line, "msgid_plural \"")) + { + if (!mFile.getline(line, 1000)) + return false; + } mLine = line; return true; } @@ -172,7 +178,10 @@ bool PoParser::readMsgId() bool PoParser::readMsgStr() { + // normal msgstr const std::string msgStr1("msgstr \""); + // plurals first msgstr + const std::string msgStr2("msgstr[0] \""); // check if in reading process if (mReadingStr) @@ -200,12 +209,23 @@ bool PoParser::readMsgStr() { mReadingStr = true; const size_t msgStr1Size = msgStr1.size(); - // reading text from: msgid "text" + // reading text from: msgstr "text" mMsgStr.append(mLine.substr(msgStr1Size, mLine.size() - 1 - msgStr1Size)); mLine.clear(); return true; } + // checl list start from msgstr[0] " + else if (strStartWith(mLine, msgStr2)) + { + mReadingStr = true; + const size_t msgStr2Size = msgStr2.size(); + // reading text from: msgstr[0] "text" + mMsgStr.append(mLine.substr(msgStr2Size, + mLine.size() - 1 - msgStr2Size)); + mLine.clear(); + return true; + } } // stop reading in other case |