summaryrefslogtreecommitdiffstats
path: root/tests/auto/linguist/lupdate/testdata/good/parsejs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/linguist/lupdate/testdata/good/parsejs')
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsejs/main.js91
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsejs/project.pro3
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result195
3 files changed, 289 insertions, 0 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js b/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js
new file mode 100644
index 000000000..9f61cea8f
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js
@@ -0,0 +1,91 @@
+qsTr("One");
+qsTranslate("FooContext", "Two");
+
+var greeting_strings = [
+ QT_TR_NOOP("Hello"),
+ QT_TRANSLATE_NOOP("FooContext", "Goodbye")
+];
+
+qsTr("One", "not the same one");
+
+//: My first comment.
+qsTr("See comment");
+
+//: My second comment.
+qsTranslate("BarContext", "See other comment");
+
+//: My third comment
+//: spans two lines.
+qsTr("The comment explains it all");
+
+//: My fourth comment
+//: spans a whopping
+//: three lines.
+qsTranslate("BazContext", "It should be clear by now");
+
+/*: C-style comment. */
+qsTr("I love C++");
+
+/*: Another C-style comment. */
+qsTranslate("FooContext", "I really love C++");
+
+/*: C-style comment, followed by */
+/*: another one. */
+qsTr("Qt is the best");
+
+/*: Another C-style comment, followed by */
+/*: yet another one. */
+qsTranslate("BarContext", "Qt is the very best");
+
+// This comment doesn't have any effect.
+qsTr("The comment had no effect");
+
+// This comment doesn't have any effect either.
+qsTranslate("BazContext", "The comment had no effect, really");
+
+/* This C-style comment doesn't have any effect. */
+qsTr("No comment to your comment");
+
+/* This C-style comment doesn't have any effect either. */
+qsTranslate("FooContext", "I refuse to comment on that");
+
+//= id_foo
+qsTr("This string has an identifier");
+
+//= id_bar
+qsTranslate("BarContext", "This string also has an identifier");
+
+//~ loc-blank False
+qsTr("This string has meta-data");
+
+//~ loc-layout_id foo_dialog
+qsTranslate("BazContext", "This string also has meta-data");
+
+// This comment is to be ignored.
+//: This is a comment for the translator.
+//= id_baz
+//~ foo 123
+//~ magic-stuff This means something special.
+qsTr("This string has a lot of information");
+
+// This comment is also to be ignored.
+//: This is another comment for the translator.
+//= id_babar
+//~ foo-bar Important stuff
+//~ needle-in-haystack Found
+//~ overflow True
+qsTranslate("FooContext", "This string has even more information");
+
+qsTr("This string has disambiguation", "Disambiguation");
+
+qsTranslate("BarContext", "This string also has disambiguation", "Another disambiguation");
+
+qsTr("This string contains plurals", "", 10);
+
+qsTrId("qtn_foo_bar");
+
+var more_greeting_strings = [ QT_TRID_NOOP("qtn_needle"), QT_TRID_NOOP("qtn_haystack") ];
+
+//: qsTrId() with comment, meta-data and plurals.
+//~ well-tested True
+qsTrId("qtn_bar_baz", 10);
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsejs/project.pro
new file mode 100644
index 000000000..d549039c4
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsejs/project.pro
@@ -0,0 +1,3 @@
+SOURCES += main.js
+
+TRANSLATIONS = project.ts
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result
new file mode 100644
index 000000000..d03c7135e
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name></name>
+ <message id="qtn_foo_bar">
+ <location filename="main.js" line="85"/>
+ <source></source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message id="qtn_needle">
+ <location filename="main.js" line="87"/>
+ <source></source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message id="qtn_haystack">
+ <location filename="main.js" line="87"/>
+ <source></source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message id="qtn_bar_baz" numerus="yes">
+ <location filename="main.js" line="91"/>
+ <source></source>
+ <extracomment>qsTrId() with comment, meta-data and plurals.</extracomment>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ <extra-well-tested>True</extra-well-tested>
+ </message>
+</context>
+<context>
+ <name>BarContext</name>
+ <message>
+ <location filename="main.js" line="15"/>
+ <source>See other comment</source>
+ <extracomment>My second comment.</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="38"/>
+ <source>Qt is the very best</source>
+ <extracomment>Another C-style comment, followed by yet another one.</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message id="id_bar">
+ <location filename="main.js" line="56"/>
+ <source>This string also has an identifier</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="81"/>
+ <source>This string also has disambiguation</source>
+ <comment>Another disambiguation</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>BazContext</name>
+ <message>
+ <location filename="main.js" line="24"/>
+ <source>It should be clear by now</source>
+ <extracomment>My fourth comment spans a whopping three lines.</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="44"/>
+ <source>The comment had no effect, really</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="62"/>
+ <source>This string also has meta-data</source>
+ <translation type="unfinished"></translation>
+ <extra-loc-layout_id>foo_dialog</extra-loc-layout_id>
+ </message>
+</context>
+<context>
+ <name>FooContext</name>
+ <message>
+ <location filename="main.js" line="2"/>
+ <source>Two</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="6"/>
+ <source>Goodbye</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="30"/>
+ <source>I really love C++</source>
+ <extracomment>Another C-style comment.</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="50"/>
+ <source>I refuse to comment on that</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message id="id_babar">
+ <location filename="main.js" line="77"/>
+ <source>This string has even more information</source>
+ <extracomment>This is another comment for the translator.</extracomment>
+ <translation type="unfinished"></translation>
+ <extra-needle-in-haystack>Found</extra-needle-in-haystack>
+ <extra-overflow>True</extra-overflow>
+ <extra-foo-bar>Important stuff</extra-foo-bar>
+ </message>
+</context>
+<context>
+ <name>main</name>
+ <message>
+ <location filename="main.js" line="1"/>
+ <source>One</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="5"/>
+ <source>Hello</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="9"/>
+ <source>One</source>
+ <comment>not the same one</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="12"/>
+ <source>See comment</source>
+ <extracomment>My first comment.</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="19"/>
+ <source>The comment explains it all</source>
+ <extracomment>My third comment spans two lines.</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="27"/>
+ <source>I love C++</source>
+ <extracomment>C-style comment.</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="34"/>
+ <source>Qt is the best</source>
+ <extracomment>C-style comment, followed by another one.</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="41"/>
+ <source>The comment had no effect</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="47"/>
+ <source>No comment to your comment</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message id="id_foo">
+ <location filename="main.js" line="53"/>
+ <source>This string has an identifier</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.js" line="59"/>
+ <source>This string has meta-data</source>
+ <translation type="unfinished"></translation>
+ <extra-loc-blank>False</extra-loc-blank>
+ </message>
+ <message id="id_baz">
+ <location filename="main.js" line="69"/>
+ <source>This string has a lot of information</source>
+ <extracomment>This is a comment for the translator.</extracomment>
+ <translation type="unfinished"></translation>
+ <extra-foo>123</extra-foo>
+ <extra-magic-stuff>This means something special.</extra-magic-stuff>
+ </message>
+ <message>
+ <location filename="main.js" line="79"/>
+ <source>This string has disambiguation</source>
+ <comment>Disambiguation</comment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message numerus="yes">
+ <location filename="main.js" line="83"/>
+ <source>This string contains plurals</source>
+ <translation type="unfinished">
+ <numerusform></numerusform>
+ </translation>
+ </message>
+</context>
+</TS>