summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/translation/poparser.cpp22
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