diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-07-03 11:28:16 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-07-06 11:54:42 (GMT) |
commit | 20d73ef1bf23569b09ca862f6c5e5971098613d6 (patch) | |
tree | 88f3aa79ab7827281b3e244ad18c10397f3e2f72 /tests/auto/linguist | |
parent | e446729d99bebaf7fac0110fcf22fc867d7229cb (diff) | |
download | Qt-20d73ef1bf23569b09ca862f6c5e5971098613d6.zip Qt-20d73ef1bf23569b09ca862f6c5e5971098613d6.tar.gz Qt-20d73ef1bf23569b09ca862f6c5e5971098613d6.tar.bz2 |
support for id-based translations
unlike in an earlier attempt, ids are textual this time.
the developer is able to provide a template for the string. when lupdate
and lrelease are integrated into the build process, this makes it
possible to avoid a round-trip to a dedicated string designer during the
early development stage.
Requirement-id: QT-435
Diffstat (limited to 'tests/auto/linguist')
3 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp index 512987d..ff90b3c 100644 --- a/tests/auto/linguist/lrelease/tst_lrelease.cpp +++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp @@ -55,6 +55,7 @@ private slots: void translate(); void mixedcodecs(); void compressed(); + void idbased(); void dupes(); private: @@ -191,6 +192,18 @@ void tst_lrelease::compressed() } +void tst_lrelease::idbased() +{ + QVERIFY(!QProcess::execute("lrelease -idbased testdata/idbased.ts")); + + QTranslator translator; + QVERIFY(translator.load("testdata/idbased.qm")); + qApp->installTranslator(&translator); + + QCOMPARE(qtTrId("test_id"), QString::fromAscii("This is a test string.")); + QCOMPARE(qtTrId("untranslated_id"), QString::fromAscii("This has no translation.")); +} + void tst_lrelease::dupes() { QProcess proc; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp index 9fb43fe..735e4cd 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -175,3 +175,15 @@ class TestingTake17 : QObject { tr("even more cool"); } }; + + + + +//: again an extra comment, this time for id-based NOOP +//% "This is supposed\tto be quoted \" newline\n" +//% "backslashed \\ stuff." +QT_TRID_NOOP("this_a_id") + +//~ some thing +//% "This needs to be here. Really." +QString test = qtTrId("this_another_id", n); diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index 5bd7525..97d3bce 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -2,6 +2,24 @@ <!DOCTYPE TS> <TS version="2.0"> <context> + <name></name> + <message id="this_a_id"> + <location filename="main.cpp" line="185"/> + <source>This is supposed to be quoted " newline +backslashed \ stuff.</source> + <extracomment>again an extra comment, this time for id-based NOOP</extracomment> + <translation type="unfinished"></translation> + </message> + <message id="this_another_id" numerus="yes"> + <location filename="main.cpp" line="189"/> + <source>This needs to be here. Really.</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + <extra-some>thing</extra-some> + </message> +</context> +<context> <name>Dialog2</name> <message numerus="yes"> <location filename="main.cpp" line="29"/> |