diff options
Diffstat (limited to 'tests/auto/linguist/lupdate/testdata/good/parseqml')
4 files changed, 228 insertions, 0 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml index c966fa112..c19bffc72 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml @@ -96,5 +96,12 @@ QtObject { //% "Source text" qsTrId("qtn_baz_biz"); + + //~ quoted " string with spaces " + qsTr("translation with extras-quoted field"); + + // template literals are supported + qsTr(`template literal`); + qsTranslate("TemplateLiteral", 'template literal 2'); } } diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/main_test_pragma.qml b/tests/auto/linguist/lupdate/testdata/good/parseqml/main_test_pragma.qml new file mode 100644 index 000000000..4a13bd3f0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/main_test_pragma.qml @@ -0,0 +1,104 @@ +import QtQuick 1.0 + +pragma Translator: PragmaContext +QtObject { + function translate() { + 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); + + //% "Source text" + qsTrId("qtn_baz_biz"); + + //~ quoted " string with spaces " + qsTr("translation with extras-quoted field"); + } +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro index 1040e2227..4e67693d7 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro @@ -1,3 +1,4 @@ SOURCES += main.qml +SOURCES += main_test_pragma.qml TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result index ce57bd44d..6dc3a5a27 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result @@ -5,21 +5,25 @@ <name></name> <message id="qtn_foo_bar"> <location filename="main.qml" line="89"/> + <location filename="main_test_pragma.qml" line="90"/> <source></source> <translation type="unfinished"></translation> </message> <message id="qtn_needle"> <location filename="main.qml" line="91"/> + <location filename="main_test_pragma.qml" line="92"/> <source></source> <translation type="unfinished"></translation> </message> <message id="qtn_haystack"> <location filename="main.qml" line="91"/> + <location filename="main_test_pragma.qml" line="92"/> <source></source> <translation type="unfinished"></translation> </message> <message id="qtn_bar_baz" numerus="yes"> <location filename="main.qml" line="95"/> + <location filename="main_test_pragma.qml" line="96"/> <source></source> <extracomment>qsTrId() with comment, meta-data and plurals.</extracomment> <translation type="unfinished"> @@ -29,6 +33,7 @@ </message> <message id="qtn_baz_biz"> <location filename="main.qml" line="98"/> + <location filename="main_test_pragma.qml" line="99"/> <source>Source text</source> <translation type="unfinished"></translation> </message> @@ -37,23 +42,27 @@ <name>BarContext</name> <message> <location filename="main.qml" line="19"/> + <location filename="main_test_pragma.qml" line="20"/> <source>See other comment</source> <extracomment>My second comment.</extracomment> <translation type="unfinished"></translation> </message> <message> <location filename="main.qml" line="42"/> + <location filename="main_test_pragma.qml" line="43"/> <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.qml" line="60"/> + <location filename="main_test_pragma.qml" line="61"/> <source>This string also has an identifier</source> <translation type="unfinished"></translation> </message> <message> <location filename="main.qml" line="85"/> + <location filename="main_test_pragma.qml" line="86"/> <source>This string also has disambiguation</source> <comment>Another disambiguation</comment> <translation type="unfinished"></translation> @@ -63,17 +72,20 @@ <name>BazContext</name> <message> <location filename="main.qml" line="28"/> + <location filename="main_test_pragma.qml" line="29"/> <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.qml" line="48"/> + <location filename="main_test_pragma.qml" line="49"/> <source>The comment had no effect, really</source> <translation type="unfinished"></translation> </message> <message> <location filename="main.qml" line="66"/> + <location filename="main_test_pragma.qml" line="67"/> <source>This string also has meta-data</source> <translation type="unfinished"></translation> <extra-loc-layout_id>foo_dialog</extra-loc-layout_id> @@ -83,27 +95,32 @@ <name>FooContext</name> <message> <location filename="main.qml" line="6"/> + <location filename="main_test_pragma.qml" line="7"/> <source>Two</source> <translation type="unfinished"></translation> </message> <message> <location filename="main.qml" line="10"/> + <location filename="main_test_pragma.qml" line="11"/> <source>Goodbye</source> <translation type="unfinished"></translation> </message> <message> <location filename="main.qml" line="34"/> + <location filename="main_test_pragma.qml" line="35"/> <source>I really love C++</source> <extracomment>Another C-style comment.</extracomment> <translation type="unfinished"></translation> </message> <message> <location filename="main.qml" line="54"/> + <location filename="main_test_pragma.qml" line="55"/> <source>I refuse to comment on that</source> <translation type="unfinished"></translation> </message> <message id="id_babar"> <location filename="main.qml" line="81"/> + <location filename="main_test_pragma.qml" line="82"/> <source>This string has even more information</source> <extracomment>This is another comment for the translator.</extracomment> <translation type="unfinished"></translation> @@ -113,6 +130,92 @@ </message> </context> <context> + <name>PragmaContext</name> + <message> + <location filename="main_test_pragma.qml" line="6"/> + <source>One</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="10"/> + <source>Hello</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="14"/> + <source>One</source> + <comment>not the same one</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="17"/> + <source>See comment</source> + <extracomment>My first comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="24"/> + <source>The comment explains it all</source> + <extracomment>My third comment spans two lines.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="32"/> + <source>I love C++</source> + <extracomment>C-style comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="39"/> + <source>Qt is the best</source> + <extracomment>C-style comment, followed by another one.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="46"/> + <source>The comment had no effect</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="52"/> + <source>No comment to your comment</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="64"/> + <source>This string has meta-data</source> + <translation type="unfinished"></translation> + <extra-loc-blank>False</extra-loc-blank> + </message> + <message> + <location filename="main_test_pragma.qml" line="84"/> + <source>This string has disambiguation</source> + <comment>Disambiguation</comment> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="main_test_pragma.qml" line="88"/> + <source>This string contains plurals</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message> + <location filename="main_test_pragma.qml" line="102"/> + <source>translation with extras-quoted field</source> + <translation type="unfinished"></translation> + <extra-quoted> string with spaces </extra-quoted> + </message> +</context> +<context> + <name>TemplateLiteral</name> + <message> + <location filename="main.qml" line="105"/> + <source>template literal 2</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>main</name> <message> <location filename="main.qml" line="5"/> @@ -166,6 +269,7 @@ </message> <message id="id_foo"> <location filename="main.qml" line="57"/> + <location filename="main_test_pragma.qml" line="58"/> <source>This string has an identifier</source> <translation type="unfinished"></translation> </message> @@ -177,6 +281,7 @@ </message> <message id="id_baz"> <location filename="main.qml" line="73"/> + <location filename="main_test_pragma.qml" line="74"/> <source>This string has a lot of information</source> <extracomment>This is a comment for the translator.</extracomment> <translation type="unfinished"></translation> @@ -196,5 +301,16 @@ <numerusform></numerusform> </translation> </message> + <message> + <location filename="main.qml" line="101"/> + <source>translation with extras-quoted field</source> + <translation type="unfinished"></translation> + <extra-quoted> string with spaces </extra-quoted> + </message> + <message> + <location filename="main.qml" line="104"/> + <source>template literal</source> + <translation type="unfinished"></translation> + </message> </context> </TS> |