summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-03 18:14:54 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-03 18:14:54 +0300
commitb9f034639f3371187a95c9a6ed859948fcccd72a (patch)
tree95605e7f7514b1b2132b05503dd4303ef0586d9f
parent00a41b3346a0e6aadad025a90b0089a01aa7df3e (diff)
downloadmplint-b9f034639f3371187a95c9a6ed859948fcccd72a.tar.gz
mplint-b9f034639f3371187a95c9a6ed859948fcccd72a.tar.bz2
mplint-b9f034639f3371187a95c9a6ed859948fcccd72a.tar.xz
mplint-b9f034639f3371187a95c9a6ed859948fcccd72a.zip
Add basic support for checking plurals in po files.
-rw-r--r--src/rules/po.cpp8
-rw-r--r--tests/testreport.txt1
-rw-r--r--tests/testsrc/bad/uk.po9
3 files changed, 17 insertions, 1 deletions
diff --git a/src/rules/po.cpp b/src/rules/po.cpp
index 54f34bc..f0d743f 100644
--- a/src/rules/po.cpp
+++ b/src/rules/po.cpp
@@ -142,7 +142,8 @@ parseLineRule(po)
else
print("Wrong msgId line. Missing last \".");
}
- else if (findCutFirst(data, "msgstr \""))
+ else if (findCutFirst(data, "msgstr \"") ||
+ findCutFirst(data, "msgstr[0] \""))
{ // msgStr start
if (readId)
readId = false;
@@ -152,6 +153,11 @@ parseLineRule(po)
else
print("Wrong msgStr line. Missing last \".");
}
+ else if (findCutFirst(data, "msgid_plural \"") ||
+ findCutFirst(data, "msgstr["))
+ {
+ // nothing
+ }
else if (findCutFirst(data, "\""))
{ // line start with "
if (readId)
diff --git a/tests/testreport.txt b/tests/testreport.txt
index 366e750..4c8dcbf 100644
--- a/tests/testreport.txt
+++ b/tests/testreport.txt
@@ -43,6 +43,7 @@
[testsrc/bad/license6.h:5]: V005: Missing "This file is part of The ManaPlus Client."
[testsrc/bad/packet.cpp:25]: V012: Wrong output packet creation. Must be 'createOutPacket(CMSG...'
[testsrc/bad/uk.po:2257]: V010: Wrong character at end of translation line.
+[testsrc/bad/uk.po:3712]: V010: Wrong character at end of translation line.
[testsrc/bad/virtual1.cpp:33]: V013: Keywords virtual is useless if used with override or final
[testsrc/bad/virtual1.cpp:36]: V013: Keywords virtual is useless if used with override or final
[testsrc/bad/virtual1.h:31]: V013: Keywords virtual is useless if used with override or final
diff --git a/tests/testsrc/bad/uk.po b/tests/testsrc/bad/uk.po
index c9c6c77..1aef374 100644
--- a/tests/testsrc/bad/uk.po
+++ b/tests/testsrc/bad/uk.po
@@ -3701,6 +3701,15 @@ msgstr ""
msgid "unnamed"
msgstr ""
+#. TRANSLATORS: This sentence may be translated differently
+#. for different grammatical numbers (singular, plural, ...)
+#: src/localplayer.cpp:922
+#, c-format
+msgid "You picked up %d [@@%d|%s@@]1."
+msgid_plural "You picked up %d [@@%d|%s@@]1."
+msgstr[0] "You picked up %d [@@%d|%s@@]1"
+msgstr[1] ""
+
#~ msgid "no"
#~ msgstr "ні"