summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptengine
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-11-19 09:05:23 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-11-19 09:07:33 (GMT)
commit2c3c8f63c36afaa47f94492215fa87989484a004 (patch)
tree02304c58778694195a8d4c5e2d6fe21242deedd9 /tests/auto/qscriptengine
parent10d8e6d4915c260c7b26f85d993f3416287de074 (diff)
downloadQt-2c3c8f63c36afaa47f94492215fa87989484a004.zip
Qt-2c3c8f63c36afaa47f94492215fa87989484a004.tar.gz
Qt-2c3c8f63c36afaa47f94492215fa87989484a004.tar.bz2
Add script translation test data for plural forms
Diffstat (limited to 'tests/auto/qscriptengine')
-rw-r--r--tests/auto/qscriptengine/translatable.js3
-rw-r--r--tests/auto/qscriptengine/translations/translatable_la.qmbin678 -> 975 bytes
-rw-r--r--tests/auto/qscriptengine/translations/translatable_la.ts16
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp11
4 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qscriptengine/translatable.js b/tests/auto/qscriptengine/translatable.js
index 30e139a..c0d7ed0 100644
--- a/tests/auto/qscriptengine/translatable.js
+++ b/tests/auto/qscriptengine/translatable.js
@@ -7,3 +7,6 @@ var greeting_strings = [
];
qsTr("One", "not the same one");
+
+qsTr("%n message(s) saved", "", 10);
+qsTranslate("FooContext", "%n fooish bar(s) found", "", "UnicodeUTF8", 10);
diff --git a/tests/auto/qscriptengine/translations/translatable_la.qm b/tests/auto/qscriptengine/translations/translatable_la.qm
index 703d0f1..d76b1ca 100644
--- a/tests/auto/qscriptengine/translations/translatable_la.qm
+++ b/tests/auto/qscriptengine/translations/translatable_la.qm
Binary files differ
diff --git a/tests/auto/qscriptengine/translations/translatable_la.ts b/tests/auto/qscriptengine/translations/translatable_la.ts
index 1598f39..36271c9 100644
--- a/tests/auto/qscriptengine/translations/translatable_la.ts
+++ b/tests/auto/qscriptengine/translations/translatable_la.ts
@@ -26,6 +26,14 @@
<source>Goodbye</source>
<translation>Farvel</translation>
</message>
+ <message numerus="yes">
+ <location filename="translatable.js" line="12"/>
+ <source>%n fooish bar(s) found</source>
+ <translation>
+ <numerusform>%n fooaktig bar funnet</numerusform>
+ <numerusform>%n fooaktige barer funnet</numerusform>
+ </translation>
+ </message>
</context>
<context>
<name>translatable</name>
@@ -45,6 +53,14 @@
<comment>not the same one</comment>
<translation>Enda en</translation>
</message>
+ <message numerus="yes">
+ <location filename="translatable.js" line="11"/>
+ <source>%n message(s) saved</source>
+ <translation>
+ <numerusform>%n melding lagret</numerusform>
+ <numerusform>%n meldinger lagret</numerusform>
+ </translation>
+ </message>
<message>
<source>Goodbye</source>
<translation type="obsolete">Farvel</translation>
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 757ec14..2fe7a2d 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -4772,6 +4772,11 @@ void tst_QScriptEngine::translateScript_data()
<< QString::fromLatin1("eval('qsTr(\\'One\\')')") << fileName << QString::fromLatin1("En");
QTest::newRow("eval('qsTr(\\'Hello\\')')@translatable.js")
<< QString::fromLatin1("eval('qsTr(\\'Hello\\')')") << fileName << QString::fromLatin1("Hallo");
+ // Plural
+ QTest::newRow("qsTr('%n message(s) saved', '', 1)@translatable.js")
+ << QString::fromLatin1("qsTr('%n message(s) saved', '', 1)") << fileName << QString::fromLatin1("1 melding lagret");
+ QTest::newRow("qsTr('%n message(s) saved', '', 3).arg@translatable.js")
+ << QString::fromLatin1("qsTr('%n message(s) saved', '', 3)") << fileName << QString::fromLatin1("3 meldinger lagret");
// Top-level
QTest::newRow("qsTranslate('FooContext', 'Two')@translatable.js")
@@ -4798,6 +4803,12 @@ void tst_QScriptEngine::translateScript_data()
QTest::newRow("qsTr('One', 'not the same one', 42)@translatable.js")
<< QString::fromLatin1("qsTr('One', 'not the same one', 42)") << fileName << QString::fromLatin1("One");
+ // Plural
+ QTest::newRow("qsTranslate('FooContext', '%n fooish bar(s) found', '', 'UnicodeUTF8', 1)@translatable.js")
+ << QString::fromLatin1("qsTranslate('FooContext', '%n fooish bar(s) found', '', 'UnicodeUTF8', 1)") << fileName << QString::fromLatin1("1 fooaktig bar funnet");
+ QTest::newRow("qsTranslate('FooContext', '%n fooish bar(s) found', '', 'UnicodeUTF8', 2)@translatable.js")
+ << QString::fromLatin1("qsTranslate('FooContext', '%n fooish bar(s) found', '', 'UnicodeUTF8', 2)") << fileName << QString::fromLatin1("2 fooaktige barer funnet");
+
// Don't exist in translation
QTest::newRow("qsTr('Three')@translatable.js")
<< QString::fromLatin1("qsTr('Three')") << fileName << QString::fromLatin1("Three");