From b9f034639f3371187a95c9a6ed859948fcccd72a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Jan 2016 18:14:54 +0300 Subject: Add basic support for checking plurals in po files. --- src/rules/po.cpp | 8 +++++++- tests/testreport.txt | 1 + tests/testsrc/bad/uk.po | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) 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 "ні" -- cgit v1.2.3-60-g2f50