diff options
Diffstat (limited to 'tests/auto/linguist/lupdate/testdata')
252 files changed, 9374 insertions, 0 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd new file mode 100644 index 000000000..f0e1ab200 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd @@ -0,0 +1 @@ +TRANSLATION: ts\project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro new file mode 100644 index 000000000..d4dcda880 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro @@ -0,0 +1,3 @@ +SOURCES += src\\main.cpp + +TRANSLATIONS = ts\\project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/src/main.cpp b/tests/auto/linguist/lupdate/testdata/good/backslashes/src/main.cpp new file mode 100644 index 000000000..d95b710c1 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/src/main.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! +// +// +// +// + +QString qt_detectRTLLanguage() +{ + return QApplication::tr("QT_LAYOUT_DIRECTION", + "Translate this string to the string 'LTR' in left-to-right" + " languages or to 'RTL' in right-to-left languages (such as Hebrew" + " and Arabic) to get proper widget layout.") == QLatin1String("RTL"); +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result new file mode 100644 index 000000000..d3a5fdf9e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/ts/project.ts.result @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>QApplication</name> + <message> + <location filename="../src/main.cpp" line="51"/> + <source>QT_LAYOUT_DIRECTION</source> + <comment>Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout.</comment> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_deeppath/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/cmdline_deeppath/lupdatecmd new file mode 100644 index 000000000..301d839a7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_deeppath/lupdatecmd @@ -0,0 +1,2 @@ +cd ../../recursivescan +lupdate sub/finddialog.cpp -ts project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_deeppath/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/cmdline_deeppath/project.ts.result new file mode 100644 index 000000000..5c3c21c34 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_deeppath/project.ts.result @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>FindDialog</name> + <message> + <location filename="sub/finddialog.cpp" line="57"/> + <source>Enter the text you want to find.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="sub/finddialog.cpp" line="66"/> + <source>Search reached end of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="sub/finddialog.cpp" line="68"/> + <source>Search reached start of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="sub/finddialog.cpp" line="70"/> + <source>Text not found</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_order/a.h b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/a.h new file mode 100644 index 000000000..c153962ff --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/a.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#define XX QT_TRANSLATE_NOOP("aaa", "some text") diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_order/b.h b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/b.h new file mode 100644 index 000000000..7ab2d6f95 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/b.h @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "a.h" + +#define YY QT_TRANSLATE_NOOP("bbb", "some text") diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_order/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/lupdatecmd new file mode 100644 index 000000000..edd91f7e3 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/lupdatecmd @@ -0,0 +1 @@ +lupdate b.h a.h -ts project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_order/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/project.ts.result new file mode 100644 index 000000000..6028cbbe0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/project.ts.result @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>aaa</name> + <message> + <location filename="a.h" line="42"/> + <source>some text</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>bbb</name> + <message> + <location filename="b.h" line="44"/> + <source>some text</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_recurse/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/cmdline_recurse/lupdatecmd new file mode 100644 index 000000000..1814e67ca --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_recurse/lupdatecmd @@ -0,0 +1,2 @@ +cd ../../recursivescan +lupdate . -ts project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_recurse/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/cmdline_recurse/project.ts.result new file mode 100644 index 000000000..95a34fa80 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_recurse/project.ts.result @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>FindDialog</name> + <message> + <location filename="project.ui" line="57"/> + <source>Qt Assistant - Finn text</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="project.ui" line="60"/> + <source>Finn tekst</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="sub/finddialog.cpp" line="57"/> + <source>Enter the text you want to find.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="sub/finddialog.cpp" line="66"/> + <source>Search reached end of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="sub/finddialog.cpp" line="68"/> + <source>Search reached start of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="sub/finddialog.cpp" line="70"/> + <source>Text not found</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="53"/> + <source> +newline at the start</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="54"/> + <source>newline at the end +</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="55"/> + <source>newline and space at the end + </source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="56"/> + <source>space and newline at the end +</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="57"/> + <source> Tab at the start and newline at the end +</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="58"/> + <source> + newline and tab at the start</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="59"/> + <source> space and tab at the start</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="60"/> + <source> space_first</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="61"/> + <source>space_last </source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>text/c++</name> + <message> + <location filename="sub/filetypes/main.c++" line="47"/> + <source>test</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>text/cpp</name> + <message> + <location filename="sub/filetypes/main.cpp" line="47"/> + <source>test</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>text/cxx</name> + <message> + <location filename="sub/filetypes/main.cxx" line="47"/> + <source>test</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp new file mode 100644 index 000000000..c9e37a09f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QtGui> +#include <QtCore> +#include <QTextCodec> + +int main(int argc, char **argv) +{ + QApplication a(argc, argv); + QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); + + QWidget w; + QLabel label1(QObject::tr("abc", "ascii"), &w); + QLabel label2(QObject::tr("æøå", "utf-8"), &w); + QLabel label2a(QObject::tr("\303\246\303\270\303\245", "utf-8 oct"), &w); + QLabel label3(QObject::trUtf8("Für Élise", "trUtf8"), &w); + QLabel label3a(QObject::trUtf8("F\303\274r \303\211lise", "trUtf8 oct"), &w); + + QBoxLayout *ly = new QVBoxLayout(&w); + ly->addWidget(&label1); + ly->addWidget(&label2); + ly->addWidget(&label2a); + ly->addWidget(&label3); + ly->addWidget(&label3a); + + w.show(); + return a.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro new file mode 100644 index 000000000..7225608b8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro @@ -0,0 +1,7 @@ +SOURCES += main.cpp +CONFIG+= console + +TRANSLATIONS = project.ts + +CODECFORTR = utf-8 +CODECFORSRC = utf-8 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result new file mode 100644 index 000000000..711bf025a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<defaultcodec>UTF-8</defaultcodec> +<context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="53"/> + <source>abc</source> + <comment>ascii</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="54"/> + <source>æøå</source> + <comment>utf-8</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="55"/> + <source>æøå</source> + <comment>utf-8 oct</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="56"/> + <source>Für Élise</source> + <comment>trUtf8</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="57"/> + <source>Für Élise</source> + <comment>trUtf8 oct</comment> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr/main.cpp new file mode 100644 index 000000000..fad7f4013 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr/main.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QtGui> +#include <QtCore> +#include <QTextCodec> + +int main(int argc, char **argv) +{ + QApplication a(argc, argv); + QTranslator trans(0); + + trans.load("t1_en", "."); + + a.installTranslator(&trans); + QWidget w; +/* + QLabel label1(QObject::tr("\33"), &w); + QLabel label2(QObject::tr("\32"), &w); + QLabel label3(QObject::tr("\176"), &w); +*/ + QLabel label4(QObject::tr("\301"), &w); + + w.show(); + return a.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro new file mode 100644 index 000000000..64f3c8590 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro @@ -0,0 +1,6 @@ +SOURCES += main.cpp +CONFIG+= console + +TRANSLATIONS = project.ts + +CODECFORTR = CP1251 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result new file mode 100644 index 000000000..6ee369a78 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<defaultcodec>windows-1251</defaultcodec> +<context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="61"/> + <source>Б</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp new file mode 100644 index 000000000..c2ed5cbcb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore> + +class FooBar : QObject +{ + Q_OBJECT + +public: + void doFoo() + { + tr("random ascii only"); + tr("this contains an umlaut ü ü literally"); + tr("this contains an umlaut \xfc ü escaped"); + trUtf8("random ascii only in utf8"); + trUtf8("umlaut ü ü in literal utf8"); + trUtf8("umlaut \303\274 ü in escaped utf8"); + } +}; + +int main(int argc, char **argv) +{ + return 0; +} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro new file mode 100644 index 000000000..d5697ebb9 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro @@ -0,0 +1,6 @@ +SOURCES += main.cpp +CONFIG += console + +TRANSLATIONS = project.ts + +CODECFORTR = CP1252 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result new file mode 100644 index 000000000..d548e2465 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<defaultcodec>windows-1252</defaultcodec> +<context> + <name>FooBar</name> + <message> + <location filename="main.cpp" line="51"/> + <source>random ascii only</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="52"/> + <source>this contains an umlaut ü &uuml; literally</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="53"/> + <source>this contains an umlaut ü &uuml; escaped</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="54"/> + <source>random ascii only in utf8</source> + <translation type="unfinished"></translation> + </message> + <message utf8="true"> + <location filename="main.cpp" line="55"/> + <source>umlaut ü &uuml; in literal utf8</source> + <translation type="unfinished"></translation> + </message> + <message utf8="true"> + <location filename="main.cpp" line="56"/> + <source>umlaut ü &uuml; in escaped utf8</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp new file mode 100644 index 000000000..2800eebfe --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore> + +class FooBar : QObject +{ + Q_OBJECT + +public: + void doFoo() + { + tr("random ascii only"); + tr("this contains an umlaut ü ü literally"); + tr("this contains an umlaut \303\274 ü escaped, really in utf-8"); + trUtf8("random ascii only in utf8"); + trUtf8("umlaut \303\274 ü in escaped utf8"); + } +}; + +int main(int argc, char **argv) +{ + return 0; +} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro new file mode 100644 index 000000000..c95939c3b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro @@ -0,0 +1,7 @@ +SOURCES += main.cpp +CONFIG += console + +TRANSLATIONS = project.ts + +CODECFORSRC = CP1252 +CODECFORTR = UTF-8 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result new file mode 100644 index 000000000..6728a256b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<defaultcodec>UTF-8</defaultcodec> +<context> + <name>FooBar</name> + <message> + <location filename="main.cpp" line="51"/> + <source>random ascii only</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="52"/> + <source>this contains an umlaut ü &uuml; literally</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="53"/> + <source>this contains an umlaut ü &uuml; escaped, really in utf-8</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="54"/> + <source>random ascii only in utf8</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="55"/> + <source>umlaut ü &uuml; in escaped utf8</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/expectedoutput.txt new file mode 100644 index 000000000..feecddace --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/expectedoutput.txt @@ -0,0 +1 @@ +lupdate warning: Codec for tr\(\) 'ISO-8859-1' disagrees with existing file's codec 'UTF-8'\. Expect trouble\. diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/main.cpp new file mode 100644 index 000000000..b59af2b00 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/main.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +int main(int argc, char **argv) +{ + QObject::tr("hi"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.pro new file mode 100644 index 000000000..00a4dc488 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.pro @@ -0,0 +1,4 @@ +SOURCES += main.cpp + +TRANSLATIONS = project.ts +CODECFORTR = latin1 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.before new file mode 100644 index 000000000..07ad79b82 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.before @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<defaultcodec>UTF-8</defaultcodec> +<context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="44"/> + <source>hi</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.result new file mode 100644 index 000000000..b6899c162 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr3/project.ts.result @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="44"/> + <source>hi</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/expectedoutput.txt new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/expectedoutput.txt diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/main.cpp new file mode 100644 index 000000000..b59af2b00 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/main.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +int main(int argc, char **argv) +{ + QObject::tr("hi"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.pro new file mode 100644 index 000000000..4fddb0242 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.pro @@ -0,0 +1,4 @@ +SOURCES += main.cpp + +TRANSLATIONS = project.ts +CODECFORTR = latin2 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.before new file mode 100644 index 000000000..e18e34e0e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.before @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<defaultcodec>ISO-8859-2</defaultcodec> +<context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="44"/> + <source>hi</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.result new file mode 100644 index 000000000..e18e34e0e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr4/project.ts.result @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<defaultcodec>ISO-8859-2</defaultcodec> +<context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="44"/> + <source>hi</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/from_subdir/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/from_subdir/lupdatecmd new file mode 100644 index 000000000..8a5b4ada3 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/from_subdir/lupdatecmd @@ -0,0 +1 @@ +lupdate translations/translations.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/from_subdir/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/from_subdir/project.ts.result new file mode 100644 index 000000000..7167cf33c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/from_subdir/project.ts.result @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>QApplication</name> + <message> + <location filename="src/main.cpp" line="49"/> + <source>string in main.cpp</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="src/main.h" line="45"/> + <source>string in main.h</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.cpp b/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.cpp new file mode 100644 index 000000000..26eeee237 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +#include "main.h" + +int main(char **argv, int argc) +{ + return QApplication::tr("string in main.cpp"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.h b/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.h new file mode 100644 index 000000000..0918b5153 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/from_subdir/src/main.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +QT_TRANSLATE_NOOP("QApplication", "string in main.h") diff --git a/tests/auto/linguist/lupdate/testdata/good/from_subdir/translations/translations.pro b/tests/auto/linguist/lupdate/testdata/good/from_subdir/translations/translations.pro new file mode 100644 index 000000000..1815c37dc --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/from_subdir/translations/translations.pro @@ -0,0 +1,7 @@ +VPATH = ../src +INCLUDEPATH = ../src + +SOURCES += main.cpp +HEADERS += main.h + +TRANSLATIONS += ../project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt new file mode 100644 index 000000000..1eed403b7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/expectedoutput.txt @@ -0,0 +1,5 @@ +Updating 'project\.ts'\.\.\. + Found 3 source text\(s\) \(3 new and 0 already existing\) + Removed 5 obsolete entries + Number heuristic provided 1 translation\(s\) + Same-text heuristic provided 1 translation\(s\) diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/heuristics/lupdatecmd new file mode 100644 index 000000000..6bda26175 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/lupdatecmd @@ -0,0 +1,2 @@ +TRANSLATION: project.ts +lupdate -verbose -disable-heuristic similartext -no-obsolete project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp b/tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp new file mode 100644 index 000000000..4da14736c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/main.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +#define QTCORE <QtCore> +#include QTCORE // Hidden from lupdate, but compiles + +class A: public QObject { + Q_OBJECT + void foo() + { + // number Heuristics + tr("version 2.0 now"); + + // same text match + tr("this is the matched same text"); + + // failed same text + tr("this is the non-matched same text"); + } +}; + diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro new file mode 100644 index 000000000..759bea068 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.pro @@ -0,0 +1,3 @@ +SOURCES = main.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before new file mode 100644 index 000000000..ce8281033 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>A</name> + <message> + <location filename="main.cpp" line="53"/> + <source>version 1.0 now</source> + <translation>teraz wersja 1.0</translation> + </message> +</context> +<context> + <name>B</name> + <message> + <location filename="main.cpp" line="56"/> + <source>this is the matched same text</source> + <translation>der same-text-treffer</translation> + </message> + <message> + <location filename="main.cpp" line="59"/> + <source>this is the non-matched same text</source> + <translation>same-text-reinfall variante eins</translation> + </message> +</context> +<context> + <name>C</name> + <message> + <location filename="main.cpp" line="56"/> + <source>this is the matched same text</source> + <translation>der same-text-treffer</translation> + </message> + <message> + <location filename="main.cpp" line="59"/> + <source>this is the non-matched same text</source> + <translation>völlig andere variante des reinfalls mit same-text</translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result new file mode 100644 index 000000000..402ad9a9b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>A</name> + <message> + <location filename="main.cpp" line="53"/> + <source>version 2.0 now</source> + <translation type="unfinished">teraz wersja 1.0 {2.0 ?}</translation> + </message> + <message> + <location filename="main.cpp" line="56"/> + <source>this is the matched same text</source> + <translation type="unfinished">der same-text-treffer</translation> + </message> + <message> + <location filename="main.cpp" line="59"/> + <source>this is the non-matched same text</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt new file mode 100644 index 000000000..f6fc40036 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt @@ -0,0 +1,4 @@ +.*/lupdate/testdata/good/lacksqobject/main.cpp:58: Class 'B' lacks Q_OBJECT macro +.*/lupdate/testdata/good/lacksqobject/main.cpp:65: Class 'C' lacks Q_OBJECT macro +.*/lupdate/testdata/good/lacksqobject/main.cpp:78: Class 'nsB::B' lacks Q_OBJECT macro +.*/lupdate/testdata/good/lacksqobject/main.cpp:84: Class 'nsB::C' lacks Q_OBJECT macro diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/main.cpp b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/main.cpp new file mode 100644 index 000000000..42e81deb2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/main.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +#define QTCORE <QtCore> +#include QTCORE // Hidden from lupdate, but compiles + +// +// Test 'lacks Q_OBJECT' reporting on namespace scopes +// + +class B : public QObject { + //Q_OBJECT + void foo(); +}; + +void B::foo() { + tr("Bla", "::B"); +} + + +class C : public QObject { + //Q_OBJECT + void foo() { + tr("Bla", "::C"); + } +}; + + +namespace nsB { + + class B : public QObject { + //Q_OBJECT + void foo(); + }; + + void B::foo() { + tr("Bla", "nsB::B"); + } + + class C : public QObject { + //Q_OBJECT + void foo() { + tr("Bla", "nsB::C"); + } + }; +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro new file mode 100644 index 000000000..759bea068 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro @@ -0,0 +1,3 @@ +SOURCES = main.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.ts.result new file mode 100644 index 000000000..bc876cdb1 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.ts.result @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>B</name> + <message> + <location filename="main.cpp" line="58"/> + <source>Bla</source> + <comment>::B</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>C</name> + <message> + <location filename="main.cpp" line="65"/> + <source>Bla</source> + <comment>::C</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>nsB::B</name> + <message> + <location filename="main.cpp" line="78"/> + <source>Bla</source> + <comment>nsB::B</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>nsB::C</name> + <message> + <location filename="main.cpp" line="84"/> + <source>Bla</source> + <comment>nsB::C</comment> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp new file mode 100644 index 000000000..838f305d2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp @@ -0,0 +1,69 @@ + +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// The first line in this file should always be empty, its part of the test!! +class Foo : public QObject +{ + Q_OBJECT +public: + Foo(); +}; + +Foo::Foo(MainWindow *parent) + : QObject(parent) +{ + tr("This is the first entry."); + tr("A second message."); tr("And a second one on the same line."); + tr("This string did move from the bottom."); + tr("This tr is new."); + tr("This one moved in from another file."); + tr("Now again one which is just where it was."); + + tr("Just as this one."); + tr("Another alien."); + tr("This is from the bottom, too."); + tr("Third string from the bottom."); + tr("Fourth one!"); + tr("They are coming!"); + tr("They are everywhere!"); + tr("An earthling again."); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd new file mode 100644 index 000000000..82b4b0d6f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd @@ -0,0 +1 @@ +lupdate -locations relative project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro new file mode 100644 index 000000000..614985830 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro @@ -0,0 +1,3 @@ +SOURCES += foo.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.before new file mode 100644 index 000000000..1762cc7b4 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.before @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS><TS version="2.0"> +<context> + <name>Bar</name> + <message> + <location filename="bar1.cpp" line="54"/> + <source>Another alien.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="bar1.cpp" line="55"/> + <source>They are coming!</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="bar1.cpp" line="57"/> + <source>They are everywhere!</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="bar1.cpp" line="59"/> + <source>This one moved in from another file.</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Foo</name> + <message> + <location filename="foo1.cpp" line="54"/> + <source>This is the first entry.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="foo1.cpp" line="55"/> + <source>A second message.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="foo1.cpp" line="56"/> + <source>Now again one which is just where it was.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="foo1.cpp" line="57"/> + <source>Just as this one.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="foo1.cpp" line="58"/> + <source>An earthling again.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="foo1.cpp" line="59"/> + <source>This is from the bottom, too.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="foo1.cpp" line="60"/> + <source>Third string from the bottom.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="foo1.cpp" line="61"/> + <source>Fourth one!</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="foo1.cpp" line="62"/> + <source>This string did move from the bottom.</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.result new file mode 100644 index 000000000..5104860c3 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.result @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>Foo</name> + <message> + <location filename="foo.cpp" line="+54"/> + <source>This is the first entry.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> + <source>A second message.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+0"/> + <source>And a second one on the same line.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+2"/> + <source>This tr is new.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> + <source>This one moved in from another file.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> + <source>Now again one which is just where it was.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+2"/> + <source>Just as this one.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> + <source>Another alien.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+4"/> + <source>They are coming!</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> + <source>They are everywhere!</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> + <source>An earthling again.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="-5"/> + <source>This is from the bottom, too.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> + <source>Third string from the bottom.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> + <source>Fourth one!</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="-9"/> + <source>This string did move from the bottom.</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro new file mode 100644 index 000000000..fa56972dd --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro @@ -0,0 +1,3 @@ +FORMS += project.ui + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.before new file mode 100644 index 000000000..fdc2a9980 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.before @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<!DOCTYPE TS><TS version="1.1"> +<context> + <name>FindDialog</name> + <message> + <source>Qt Assistant - Finn text</source> + <translation></translation> + </message> + <message> + <source>Finn tekst</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.result new file mode 100644 index 000000000..f9d26df2a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.result @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>FindDialog</name> + <message> + <source>Qt Assistant - Finn text</source> + <translation></translation> + </message> + <message> + <source>Finn tekst</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ui b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ui new file mode 100644 index 000000000..d8c35ccc1 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ui @@ -0,0 +1,72 @@ +<ui version="4.0" > + <author></author> + <comment>********************************************************************* +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <exportmacro></exportmacro> + <class>FindDialog</class> + <widget class="QWidget" name="FindDialog" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>172</height> + </rect> + </property> + <property name="windowTitle" > + <string>Qt Assistant - Finn text</string><!-- changed to uppercase --> + </property> + <property name="height" > + <string>Finn tekst</string> + </property> + </widget> + <tabstops> + <tabstop>comboFind</tabstop> + <tabstop>checkWords</tabstop> + <tabstop>checkCase</tabstop> + <tabstop>radioForward</tabstop> + <tabstop>radioBackward</tabstop> + <tabstop>findButton</tabstop> + <tabstop>closeButton</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp new file mode 100644 index 000000000..fb12bc0d9 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QDebug> + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + QTranslator translator; + translator.load("whitespace"); + app.installTranslator(&translator); + + QObject::tr("\nnewline at the start"); + QObject::tr("newline at the end\n"); + QObject::tr("newline and space at the end\n "); + QObject::tr("space and newline at the end \n"); + QObject::tr("\tTab at the start and newline at the end\n"); + QObject::tr("\n\tnewline and tab at the start"); + QObject::tr(" \tspace and tab at the start"); + QObject::tr(" space_first"); + QObject::tr("space_last "); + QObject::tr("carriage return and line feed last\r\n"); + return app.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro new file mode 100644 index 000000000..759bea068 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro @@ -0,0 +1,3 @@ +SOURCES = main.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.before new file mode 100644 index 000000000..0f84fedb8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.before @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS><TS version="1.1"> +<context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="7"/> + <source> +newline at the start</source> + <translation> +NEWLINE AT THE START</translation> + </message> + <message> + <location filename="main.cpp" line="49"/> + <source>newline at the end +</source> + <translation>NEWLINE AT THE END +</translation> + </message> + <message> + <location filename="main.cpp" line="50"/> + <source>newline and space at the end + </source> + <translation>NEWLINE AND SPACE AT THE END + </translation> + </message> + <message> + <location filename="main.cpp" line="51"/> + <source>space and newline at the end +</source> + <translation>SPACE AND NEWLINE AT THE END +</translation> + </message> + <message> + <location filename="main.cpp" line="52"/> + <source><byte value="x9"/>Tab at the start and newline at the end +</source> + <translation><byte value="x9"/>TAB AT THE START AND NEWLINE AT THE END +</translation> + </message> + <message> + <location filename="main.cpp" line="53"/> + <source> +<byte value="x9"/>newline and tab at the start</source> + <translation> +<byte value="x9"/>NEWLINE AND TAB AT THE START</translation> + </message> + <message> + <location filename="main.cpp" line="54"/> + <source> <byte value="x9"/>space and tab at the start</source> + <translation> <byte value="x9"/>SPACE AND TAB AT THE START</translation> + </message> + <message> + <location filename="main.cpp" line="55"/> + <source> space_first</source> + <translation> SPACE_FIRST</translation> + </message> + <message> + <location filename="main.cpp" line="56"/> + <source>space_last </source> + <translation>SPACE_LAST </translation> + </message> + <message> + <location filename="main.cpp" line="62"/> + <source>carriage return and line feed last<byte value="xd"/> +</source> + <translation type="unfinished">CARRIAGE RETURN AND LINE FEED LAST<byte value="xd"/> +</translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.result new file mode 100644 index 000000000..776238db8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.result @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="53"/> + <source> +newline at the start</source> + <translation> +NEWLINE AT THE START</translation> + </message> + <message> + <location filename="main.cpp" line="54"/> + <source>newline at the end +</source> + <translation>NEWLINE AT THE END +</translation> + </message> + <message> + <location filename="main.cpp" line="55"/> + <source>newline and space at the end + </source> + <translation>NEWLINE AND SPACE AT THE END + </translation> + </message> + <message> + <location filename="main.cpp" line="56"/> + <source>space and newline at the end +</source> + <translation>SPACE AND NEWLINE AT THE END +</translation> + </message> + <message> + <location filename="main.cpp" line="57"/> + <source> Tab at the start and newline at the end +</source> + <translation> TAB AT THE START AND NEWLINE AT THE END +</translation> + </message> + <message> + <location filename="main.cpp" line="58"/> + <source> + newline and tab at the start</source> + <translation> + NEWLINE AND TAB AT THE START</translation> + </message> + <message> + <location filename="main.cpp" line="59"/> + <source> space and tab at the start</source> + <translation> SPACE AND TAB AT THE START</translation> + </message> + <message> + <location filename="main.cpp" line="60"/> + <source> space_first</source> + <translation> SPACE_FIRST</translation> + </message> + <message> + <location filename="main.cpp" line="61"/> + <source>space_last </source> + <translation>SPACE_LAST </translation> + </message> + <message> + <location filename="main.cpp" line="62"/> + <source>carriage return and line feed last +</source> + <translation type="unfinished">CARRIAGE RETURN AND LINE FEED LAST +</translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp new file mode 100644 index 000000000..5f2f686a3 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp @@ -0,0 +1,82 @@ + +// The first line in this file should always be empty, its part of the test!! + +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +class FindDialog : public QDialog +{ + Q_OBJECT +public: + FindDialog(MainWindow *parent); + void reset(); +}; + +FindDialog::FindDialog(MainWindow *parent) + : QDialog(parent) +{ + QString trans = tr("Enter the text you want to find."); + trans = tr("Search reached end of the document"); + trans = tr("Search reached start of the document"); + trans = tr( "Text not found" ); +} + +void FindDialog::reset() +{ + tr("%n item(s)", "merge from singular to plural form", 4); + tr("%n item(s)", "merge from a finished singular form to an unfinished plural form", 4); + + + + //% "Hello" + qtTrId("xx_hello"); + + //% "New world" + qtTrId("xx_world"); + + + //= new_id + tr("this is just some text"); + + + //: A message without source string + qtTrId("qtn_virtual"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro new file mode 100644 index 000000000..63f5d66e2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro @@ -0,0 +1,3 @@ +SOURCES += finddialog.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before new file mode 100644 index 000000000..379cce465 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS><TS version="1.1" language="zh_CN"> +<context> + <name></name> + <message id="xx_hello"> + <location filename="finddialog.cpp" line="70"/> + <source>Hello</source> + <translation>Hallo</translation> + </message> + <message id="xx_world"> + <location filename="finddialog.cpp" line="73"/> + <source>World</source> + <translation>Welt</translation> + </message> + <message id="qtn_virtual"> + <location filename="finddialog.cpp" line="79"/> + <extracomment>A message without source string</extracomment> + </message> +</context> +<context> + <name>FindDialog</name> + <message> + <source></source> + <comment>magic context comment</comment> + <translatorcomment>random translator comment</translatorcomment> + <translation></translation> + </message> + <message> + <location filename="finddialog.cpp" line="56"/> + <source>Enter the text you want to find.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="57"/> + <source>Search reached end of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="58"/> + <source>Search reached start of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="59"/> + <source>Text not found</source> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="finddialog.cpp" line="64"/> + <source>%n item(s)</source> + <comment>merge from singular to plural form</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="finddialog.cpp" line="65"/> + <source>%n item(s)</source> + <comment>merge from a finished singular form to an unfinished plural form</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message> + <location filename="finddialog.cpp" line="59"/> + <source>this is just some text</source> + <translation type="unfinished">Unfertige Uebersetzung</translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result new file mode 100644 index 000000000..de43266d2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="zh_CN"> +<context> + <name></name> + <message id="xx_hello"> + <location filename="finddialog.cpp" line="70"/> + <source>Hello</source> + <translation>Hallo</translation> + </message> + <message id="xx_world"> + <location filename="finddialog.cpp" line="73"/> + <source>New world</source> + <oldsource>World</oldsource> + <translation type="unfinished">Welt</translation> + </message> + <message id="qtn_virtual"> + <location filename="finddialog.cpp" line="81"/> + <source></source> + <extracomment>A message without source string</extracomment> + <translation></translation> + </message> +</context> +<context> + <name>FindDialog</name> + <message> + <source></source> + <comment>magic context comment</comment> + <translatorcomment>random translator comment</translatorcomment> + <translation></translation> + </message> + <message> + <location filename="finddialog.cpp" line="56"/> + <source>Enter the text you want to find.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="57"/> + <source>Search reached end of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="58"/> + <source>Search reached start of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="59"/> + <source>Text not found</source> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="finddialog.cpp" line="64"/> + <source>%n item(s)</source> + <comment>merge from singular to plural form</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="finddialog.cpp" line="65"/> + <source>%n item(s)</source> + <comment>merge from a finished singular form to an unfinished plural form</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message id="new_id"> + <location filename="finddialog.cpp" line="77"/> + <source>this is just some text</source> + <translation type="unfinished">Unfertige Uebersetzung</translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp new file mode 100644 index 000000000..ab9b6fd68 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "finddialog.h" +#include "mainwindow.h" +#include "tabbedbrowser.h" +#include "helpwindow.h" + +#include <QTextBrowser> +#include <QTextCursor> +#include <QStatusBar> +#include <QLineEdit> +#include <QDateTime> +#include <QGridLayout> + +CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent) + : QStandardItemModel(rows, columns, parent) +{} +QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, const QVariant &value, + int hits, Qt::MatchFlags flags) const +{ + if (flags == Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) + flags |= Qt::MatchCaseSensitive; + + return QStandardItemModel::match(start, role, value, hits, flags); +} + +FindDialog::FindDialog(MainWindow *parent) + : QDialog(parent) +{ + contentsWidget = new QWidget(this); + ui.setupUi(contentsWidget); + ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind)); + + QVBoxLayout *l = new QVBoxLayout(this); + l->setMargin(0); + l->setSpacing(0); + l->addWidget(contentsWidget); + + lastBrowser = 0; + onceFound = false; + findExpr.clear(); + + sb = new QStatusBar(this); + l->addWidget(sb); + + sb->showMessage(tr("Enter the text you want to find.")); + + connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked())); + connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject())); +} + +FindDialog::~FindDialog() +{ +} + +void FindDialog::findButtonClicked() +{ + doFind(ui.radioForward->isChecked()); +} + +void FindDialog::doFind(bool forward) +{ + QTextBrowser *browser = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser()); + sb->clearMessage(); + + if (ui.comboFind->currentText() != findExpr || lastBrowser != browser) + onceFound = false; + findExpr = ui.comboFind->currentText(); + + QTextDocument::FindFlags flags = 0; + + if (ui.checkCase->isChecked()) + flags |= QTextDocument::FindCaseSensitively; + + if (ui.checkWords->isChecked()) + flags |= QTextDocument::FindWholeWords; + + QTextCursor c = browser->textCursor(); + if (!c.hasSelection()) { + if (forward) + c.movePosition(QTextCursor::Start); + else + c.movePosition(QTextCursor::End); + + browser->setTextCursor(c); + } + + QTextDocument::FindFlags options; + if (forward == false) + flags |= QTextDocument::FindBackward; + + QTextCursor found = browser->document()->find(findExpr, c, flags); + if (found.isNull()) { + if (onceFound) { + if (forward) + statusMessage(tr("Search reached end of the document")); + else + statusMessage(tr("Search reached start of the document")); + } else { + statusMessage(tr( "Text not found" )); + } + } else { + browser->setTextCursor(found); + } + onceFound |= !found.isNull(); + lastBrowser = browser; +} + +bool FindDialog::hasFindExpression() const +{ + // statusMessage(tr( "Should be obsolete" )); + + //% "This is some random text" + qtTrId("keep_id") +} diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd new file mode 100644 index 000000000..500a82247 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd @@ -0,0 +1 @@ +lupdate -noobsolete project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro new file mode 100644 index 000000000..63f5d66e2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro @@ -0,0 +1,3 @@ +SOURCES += finddialog.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before new file mode 100644 index 000000000..feab1694d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS><TS version="1.1"> +<context> + <name></name> + <message id="keep_id"> + <location filename="finddialog.cpp" line="153"/> + <source>This is some random text</source> + <translation type="unfinished"></translation> + </message> + <message id="obsolete_id"> + <location filename="finddialog.cpp" line="155"/> + <source>Should be obsolete, too</source> + <translation type="unfinished">SHOULD BE OBSOLETE AS WELL</translation> + </message> +</context> +<context> + <name>FindDialog</name> + <message> + <location filename="finddialog.cpp" line="85"/> + <source>Enter the text you want to find.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="135"/> + <source>Search reached end of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="137"/> + <source>Search reached start of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="139"/> + <source>Text not found</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="150"/> + <source>Should be obsolete</source> + <translation type="unfinished">SHOULD BE OBSOLETE</translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result new file mode 100644 index 000000000..ee3d0f69b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name></name> + <message id="keep_id"> + <location filename="finddialog.cpp" line="153"/> + <source>This is some random text</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>FindDialog</name> + <message> + <location filename="finddialog.cpp" line="85"/> + <source>Enter the text you want to find.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="135"/> + <source>Search reached end of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="137"/> + <source>Search reached start of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="139"/> + <source>Text not found</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp new file mode 100644 index 000000000..b712e0cb8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "finddialog.h" +#include "mainwindow.h" +#include "tabbedbrowser.h" +#include "helpwindow.h" + +#include <QTextBrowser> +#include <QTextCursor> +#include <QStatusBar> +#include <QLineEdit> +#include <QDateTime> +#include <QGridLayout> + +CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent) + : QStandardItemModel(rows, columns, parent) +{} +QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, const QVariant &value, + int hits, Qt::MatchFlags flags) const +{ + if (flags == Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) + flags |= Qt::MatchCaseSensitive; + + return QStandardItemModel::match(start, role, value, hits, flags); +} + +FindDialog::FindDialog(MainWindow *parent) + : QDialog(parent) +{ + contentsWidget = new QWidget(this); + ui.setupUi(contentsWidget); + ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind)); + + QVBoxLayout *l = new QVBoxLayout(this); + l->setMargin(0); + l->setSpacing(0); + l->addWidget(contentsWidget); + + lastBrowser = 0; + onceFound = false; + findExpr.clear(); + + sb = new QStatusBar(this); + l->addWidget(sb); + + + // Move it to another line and change the text, + // then lupdate should add this one as a new one, and mark the old one as obsolete. + sb->showMessage(tr("Enter the text you want to find.")); + + connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked())); + connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject())); +} + +FindDialog::~FindDialog() +{ +} + +void FindDialog::findButtonClicked() +{ + doFind(ui.radioForward->isChecked()); +} + +void FindDialog::doFind(bool forward) +{ + QTextBrowser *browser = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser()); + sb->clearMessage(); + + if (ui.comboFind->currentText() != findExpr || lastBrowser != browser) + onceFound = false; + findExpr = ui.comboFind->currentText(); + + QTextDocument::FindFlags flags = 0; + + if (ui.checkCase->isChecked()) + flags |= QTextDocument::FindCaseSensitively; + + if (ui.checkWords->isChecked()) + flags |= QTextDocument::FindWholeWords; + + QTextCursor c = browser->textCursor(); + if (!c.hasSelection()) { + if (forward) + c.movePosition(QTextCursor::Start); + else + c.movePosition(QTextCursor::End); + + browser->setTextCursor(c); + } + + QTextDocument::FindFlags options; + if (forward == false) + flags |= QTextDocument::FindBackward; + + QTextCursor found = browser->document()->find(findExpr, c, flags); + if (found.isNull()) { + if (onceFound) { + if (forward) + statusMessage(tr("Search reached end of the document")); + else + statusMessage(tr("Search reached start of the document")); + } else { + statusMessage(tr( "Text not found" )); + } + } else { + browser->setTextCursor(found); + } + onceFound |= !found.isNull(); + lastBrowser = browser; +} + +bool FindDialog::hasFindExpression() const +{ + //% "This is some random text" + qtTrId("keep_id") + + return !findExpr.isEmpty(); +} + +void FindDialog::statusMessage(const QString &message) +{ + if (isVisible()) + sb->showMessage(message); + else + static_cast<MainWindow*>(parent())->statusBar()->showMessage(message, 2000); +} + +MainWindow *FindDialog::mainWindow() const +{ + return static_cast<MainWindow*>(parentWidget()); +} + +void FindDialog::reset() +{ + ui.comboFind->setFocus(); + ui.comboFind->lineEdit()->setSelection( + 0, ui.comboFind->lineEdit()->text().length()); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro new file mode 100644 index 000000000..63f5d66e2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro @@ -0,0 +1,3 @@ +SOURCES += finddialog.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before new file mode 100644 index 000000000..2bc60491c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!DOCTYPE TS><TS version="1.1"> +<context> + <name></name> + <message id="keep_id"> + <location filename="finddialog.cpp" line="154"/> + <source>This is some random text</source> + <translation type="unfinished"></translation> + </message> + <message id="obsolete_id"> + <location filename="finddialog.cpp" line="155"/> + <source>Should be obsolete, too</source> + <translation type="unfinished">SHOULD BE OBSOLETE AS WELL</translation> + </message> +</context> +<context> + <name>FindDialog</name> + <message> + <location filename="finddialog.cpp" line="85"/> + <source>Enter the text you are looking for.</source> + <translation type="unfinished">Skriv inn teksten du soker etter</translation> + </message> + <message> + <location filename="finddialog.cpp" line="135"/> + <source>Search reached end of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="137"/> + <source>Search reached start of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="139"/> + <source>Text not found</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result new file mode 100644 index 000000000..f442cbcc9 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name></name> + <message id="keep_id"> + <location filename="finddialog.cpp" line="154"/> + <source>This is some random text</source> + <translation type="unfinished"></translation> + </message> + <message id="obsolete_id"> + <source>Should be obsolete, too</source> + <translation type="obsolete">SHOULD BE OBSOLETE AS WELL</translation> + </message> +</context> +<context> + <name>FindDialog</name> + <message> + <source>Enter the text you are looking for.</source> + <translation type="obsolete">Skriv inn teksten du soker etter</translation> + </message> + <message> + <location filename="finddialog.cpp" line="88"/> + <source>Enter the text you want to find.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="138"/> + <source>Search reached end of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="140"/> + <source>Search reached start of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="142"/> + <source>Text not found</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro new file mode 100644 index 000000000..fa56972dd --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro @@ -0,0 +1,3 @@ +FORMS += project.ui + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before new file mode 100644 index 000000000..6a1f62542 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before @@ -0,0 +1,22 @@ +<?xml version="1.0"?> +<!DOCTYPE TS><TS version="1.1"> +<context> + <name>FindDialog</name> + <message> + <location filename="project.ui" line="57"/> + <source>Qt Assistant - Find text</source> + <!--should be changed to unfinished, since we are changing the sourcetext in the UI file--> + <translation>Qt Assistant - Finn tekst</translation> + </message> + <message> + <location filename="project.ui" line="60"/> + <source>300px</source> + <translation>300px</translation> + </message> + <message> + <location filename="project.ui" line="63"/> + <source>400px</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result new file mode 100644 index 000000000..1a2244b1f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>FindDialog</name> + <message> + <location filename="project.ui" line="57"/> + <source>Qt Assistant - Find Text</source> + <oldsource>Qt Assistant - Find text</oldsource> + <translation type="unfinished">Qt Assistant - Finn tekst</translation> + </message> + <message> + <location filename="project.ui" line="60"/> + <source>300px</source> + <translation>300px</translation> + </message> + <message> + <location filename="project.ui" line="63"/> + <source>401 pixels</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui new file mode 100644 index 000000000..aeabcaa95 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui @@ -0,0 +1,77 @@ +<ui version="4.0" > + <author></author> + <comment> +********************************************************************* +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +********************************************************************* +</comment> + <exportmacro></exportmacro> + <class>FindDialog</class> + <widget class="QWidget" name="FindDialog" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>172</height> + </rect> + </property> + <property name="windowTitle" > + <string>Qt Assistant - Find Text</string><!-- changed to uppercase, marked as finished --> + </property> + <property name="height" > + <string>300px</string> + </property> + <property name="width" > + <string>401 pixels</string><!-- Changed from 400px to 401 pixels, but this is marked as unfinished --> + </property> + </widget> + <tabstops> + <tabstop>comboFind</tabstop> + <tabstop>checkWords</tabstop> + <tabstop>checkCase</tabstop> + <tabstop>radioForward</tabstop> + <tabstop>radioBackward</tabstop> + <tabstop>findButton</tabstop> + <tabstop>closeButton</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro new file mode 100644 index 000000000..fa56972dd --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro @@ -0,0 +1,3 @@ +FORMS += project.ui + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.before new file mode 100644 index 000000000..f06c22ca8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.before @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<!DOCTYPE TS><TS version="1.1"> +<context> + <name>FindDialog</name> + <message> + <location filename="project.ui" line="20"/> + <source>Test similarity</source> + <translation type="unfinished">Test likhet (test1)</translation> + </message> + <message> + <location filename="project.ui" line="23"/> + <source>Similarity should have kicked in here!</source> + <translation type="unfinished">Test likhet (test2)</translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result new file mode 100644 index 000000000..6bc565c1e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>FindDialog</name> + <message> + <source>Test similarity</source> + <translation type="obsolete">Test likhet (test1)</translation> + </message> + <message> + <location filename="project.ui" line="20"/> + <source>This should not be considered to be more or less equal to the corresponding one in the TS file.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="project.ui" line="23"/> + <source>Here, similarity should kick in!</source> + <oldsource>Similarity should have kicked in here!</oldsource> + <translation type="unfinished">Test likhet (test2)</translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui new file mode 100644 index 000000000..a5f8e9f79 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui @@ -0,0 +1,26 @@ +<ui version="4.0" > + <author></author> + <comment><!-- +********************************************************************* +** +** Do not change the location (linenumber) of the <string> elements in this file! +** That will make the test break! +** +** If you need to add some tests, please add them to the end of the file! +** +** +********************************************************************* +--> +</comment> + <exportmacro></exportmacro> + <class>FindDialog</class> + <widget class="QWidget" name="FindDialog" > + <property name="test1"> + <!-- If the sourcetext is not similar to the vernacular sourcetext, mark the old one as obsolete and the new one as unfinished --> + <string>This should not be considered to be more or less equal to the corresponding one in the TS file.</string> + </property> + <property name="test2"> + <string>Here, similarity should kick in!</string> + </property> + </widget> +</ui> diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp new file mode 100644 index 000000000..9458bc322 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +QT_TRANSLATE_NOOP("context", "just a message") + + + +//: This is one comment +QT_TRANSLATE_NOOP("context", "just a message") diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp new file mode 100644 index 000000000..8200191a4 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + + + +//: This is a comment, too. +QT_TRANSLATE_NOOP("context", "just a message") + + + + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro new file mode 100644 index 000000000..bbabdfba2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro @@ -0,0 +1,4 @@ +SOURCES += main.cpp +SOURCES += finddialog.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result new file mode 100644 index 000000000..a7ae15520 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>context</name> + <message> + <location filename="finddialog.cpp" line="42"/> + <location filename="finddialog.cpp" line="47"/> + <location filename="main.cpp" line="46"/> + <source>just a message</source> + <extracomment>This is one comment +---------- +This is a comment, too.</extracomment> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp b/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp new file mode 100644 index 000000000..e99171f16 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp @@ -0,0 +1,198 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore> + +class Class : public QObject +{ + Q_OBJECT + + class SubClass + { + void f() + { + tr("nested class context"); + } + }; + + void f() + { + tr("just class context"); + } +}; + +namespace Outer { + +class Class : public QObject { Q_OBJECT }; + +namespace Middle1 { + +class Class : public QObject { Q_OBJECT }; + +namespace Inner1 { + +class Class : public QObject { Q_OBJECT }; + +} + +namespace I = Inner1; + +class Something; +class Different; + +} + +namespace Middle2 { + +class Class : public QObject { Q_OBJECT }; + +namespace Inner2 { + +class Class : public QObject { Q_OBJECT }; + +namespace IO = Middle2; + +} + +namespace I = Inner2; + +} + +namespace MI = Middle1::Inner1; + +namespace O = ::Outer; + +class Middle1::Different : QObject { +Q_OBJECT + void f() { + tr("different namespaced class def"); + } +}; + +} + +namespace O = Outer; +namespace OM = Outer::Middle1; +namespace OMI = Outer::Middle1::I; + +int main() +{ + Class::tr("outestmost class"); + Outer::Class::tr("outer class"); + Outer::MI::Class::tr("innermost one"); + OMI::Class::tr("innermost two"); + O::Middle1::I::Class::tr("innermost three"); + O::Middle2::I::Class::tr("innermost three b"); + OM::I::Class::tr("innermost four"); + return 0; +} + +class OM::Something : QObject { +Q_OBJECT + void f() { + tr("namespaced class def"); + } + void g() { + tr("namespaced class def 2"); + } +}; + +// QTBUG-8360 +namespace A { + +void foo() +{ + using namespace A; +} + +void goo() +{ + return QObject::tr("Bla"); +} + +} + + +namespace AA { +namespace B { + +using namespace AA; + +namespace C { + +class Test : public QObject { + Q_OBJECT +}; + +} + +} + +using namespace B; +using namespace C; + +void goo() +{ + AA::Test::tr("howdy?"); +} + +} + + +namespace A1 { +namespace B { + +class Test : public QObject { + Q_OBJECT +}; + +using namespace A1; + +void foo() +{ + B::B::B::Test::tr("yeeee-ha!"); +} + +} +} + + +#include "main.moc" diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro new file mode 100644 index 000000000..c96859bdb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro @@ -0,0 +1,3 @@ +SOURCES += main.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result new file mode 100644 index 000000000..94df9d3f8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>A1::B::Test</name> + <message> + <location filename="main.cpp" line="191"/> + <source>yeeee-ha!</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>AA::B::C::Test</name> + <message> + <location filename="main.cpp" line="174"/> + <source>howdy?</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Class</name> + <message> + <location filename="main.cpp" line="52"/> + <source>nested class context</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="58"/> + <source>just class context</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="118"/> + <source>outestmost class</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Outer::Class</name> + <message> + <location filename="main.cpp" line="119"/> + <source>outer class</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Outer::Middle1::Different</name> + <message> + <location filename="main.cpp" line="106"/> + <source>different namespaced class def</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Outer::Middle1::Inner1::Class</name> + <message> + <location filename="main.cpp" line="120"/> + <source>innermost one</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="121"/> + <source>innermost two</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="122"/> + <source>innermost three</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="124"/> + <source>innermost four</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Outer::Middle1::Something</name> + <message> + <location filename="main.cpp" line="131"/> + <source>namespaced class def</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="134"/> + <source>namespaced class def 2</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Outer::Middle2::Inner2::Class</name> + <message> + <location filename="main.cpp" line="123"/> + <source>innermost three b</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="148"/> + <source>Bla</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp new file mode 100644 index 000000000..86d93ff96 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +class Dialog2 : public QDialog +{ + Q_OBJECT + void func(); + +}; + +void Dialog2::func() +{ + tr("cat\351gorie"); + + tr("F\374r \310lise") +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro new file mode 100644 index 000000000..c96859bdb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro @@ -0,0 +1,3 @@ +SOURCES += main.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.ts.result new file mode 100644 index 000000000..0394bea0e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.ts.result @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>Dialog2</name> + <message> + <location filename="main.cpp" line="54"/> + <source>catégorie</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="56"/> + <source>Für Èlise</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp new file mode 100644 index 000000000..8de7cd444 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp @@ -0,0 +1,279 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! +#include <QtCore> +#include <QtGui> + +// +// Test namespace scoping +// + +class D : public QObject { + Q_OBJECT + public: + QString foo() { + return tr("test", "D"); + } + +}; + +namespace A { + + class C : public QObject { + Q_OBJECT + public: + void foo(); + }; + + void C::foo() { + tr("Bla", "A::C"); + } + + void goo() { + C::tr("Bla", "A::C"); // Is identical to the previous tr(), (same context, sourcetext and comment, + // so it should not add another entry to the list of messages) + } + + void goo2() { + C::tr("Bla 2", "A::C"); //Should be in the same namespace as the previous tr() + } + +} + + +namespace X { + + class D : public QObject { + Q_OBJECT + public: + + }; + + class E : public QObject { + Q_OBJECT + public: + void foo() { D::tr("foo", "D"); } // Note that this is X::D from 440 on + }; + + + namespace Y { + class E : public QObject { + Q_OBJECT + + }; + + class C : public QObject { + Q_OBJECT + void foo(); + }; + + void C::foo() { + tr("Bla", "X::Y::C"); + } + + void goo() { + D::tr("Bla", "X::D"); //This should be assigned to the X::D context + } + + void goo2() { + E::tr("Bla", "X::Y::E"); //This should be assigned to the X::Y::E context + Y::E::tr("Bla", "X::Y::E"); //This should be assigned to the X::Y::E context + } + + }; // namespace Y + + class F : public QObject { + Q_OBJECT + inline void inlinefunc() { + tr("inline function", "X::F"); + } + }; +} // namespace X + +namespace ico { + namespace foo { + class A : public QObject { + A(); + }; + + A::A() { + tr("myfoo", "ico::foo::A"); + QObject::tr("task 161186", "QObject"); + } + } +} + +namespace AA { +class C {}; +} + +/** + * the context of a message should not be affected by any inherited classes + * + * Keep this disabled for now, but at a long-term range it should work. + */ +namespace Gui { + class MainWindow : public QMainWindow, + public AA::C + { + Q_OBJECT +public: + MainWindow() + { + tr("More bla", "Gui::MainWindow"); + } + + }; +} //namespace Gui + + +namespace A1 { + class AB : public QObject { + Q_OBJECT + public: + + friend class OtherClass; + + QString inlineFuncAfterFriendDeclaration() const { + return tr("inlineFuncAfterFriendDeclaration", "A1::AB"); + } + }; + class B : AB { + Q_OBJECT + public: + QString foo() const { return tr("foo", "A1::B"); } + }; + + // This is valid C++ too.... + class V : virtual AB { + Q_OBJECT + public: + QString bar() const { return tr("bar", "A1::V"); } + }; + + class W : virtual public AB { + Q_OBJECT + public: + QString baz() const { return tr("baz", "A1::W"); } + }; +} + +class ForwardDecl; + + +class B1 : public QObject { +}; + +class C1 : public QObject { +}; + +namespace A1 { + +class B2 : public QObject { +}; + +} + +void func1() +{ + B1::tr("test TRANSLATOR comment (1)", "B1"); + +} + +using namespace A1; +/* + TRANSLATOR A1::B2 +*/ +void func2() +{ + B2::tr("test TRANSLATOR comment (2)", "A1::B2"); + C1::tr("test TRANSLATOR comment (3)", "C1"); +} + +void func3() +{ + B2::tr("test TRANSLATOR comment (4)", "A1::B2"); +} + +/* + TRANSLATOR B2 + This is a comment to the translator. +*/ +void func4() +{ + B2::tr("test TRANSLATOR comment (5)", "A1::B2"); +} + +namespace A1 { +namespace B3 { +class C2 : public QObject { +QString foo(); +}; +} +} + +namespace D1 = A1::B3; +using namespace D1; + +// TRANSLATOR A1::B3::C2 +QString C2::foo() +{ + return tr("test TRANSLATOR comment (6)", "A1::B3::C2"); // 4.4 screws up +} + + +namespace Fooish { + Q_DECLARE_TR_FUNCTIONS(Bears::And::Spiders) +} + +void Fooish::bar() +{ + return tr("whatever the context", "Bears::And::Spiders"); +} + + +int main(int /*argc*/, char ** /*argv*/) { + return 0; +} + +#include "main.moc" diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro new file mode 100644 index 000000000..759bea068 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro @@ -0,0 +1,3 @@ +SOURCES = main.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result new file mode 100644 index 000000000..53d7a2581 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>A1::AB</name> + <message> + <location filename="main.cpp" line="178"/> + <source>inlineFuncAfterFriendDeclaration</source> + <comment>A1::AB</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>A1::B</name> + <message> + <location filename="main.cpp" line="184"/> + <source>foo</source> + <comment>A1::B</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>A1::B2</name> + <message> + <location filename="main.cpp" line="229"/> + <source>test TRANSLATOR comment (2)</source> + <comment>A1::B2</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="235"/> + <source>test TRANSLATOR comment (4)</source> + <comment>A1::B2</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="244"/> + <source>test TRANSLATOR comment (5)</source> + <comment>A1::B2</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>A1::B3::C2</name> + <message> + <location filename="main.cpp" line="261"/> + <source>test TRANSLATOR comment (6)</source> + <comment>A1::B3::C2</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>A1::V</name> + <message> + <location filename="main.cpp" line="191"/> + <source>bar</source> + <comment>A1::V</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>A1::W</name> + <message> + <location filename="main.cpp" line="197"/> + <source>baz</source> + <comment>A1::W</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>A::C</name> + <message> + <location filename="main.cpp" line="69"/> + <location filename="main.cpp" line="73"/> + <source>Bla</source> + <comment>A::C</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="78"/> + <source>Bla 2</source> + <comment>A::C</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>B1</name> + <message> + <location filename="main.cpp" line="219"/> + <source>test TRANSLATOR comment (1)</source> + <comment>B1</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>B2</name> + <message> + <location filename="main.cpp" line="238"/> + <source></source> + <comment>This is a comment to the translator.</comment> + <translation></translation> + </message> +</context> +<context> + <name>Bears::And::Spiders</name> + <message> + <location filename="main.cpp" line="271"/> + <source>whatever the context</source> + <comment>Bears::And::Spiders</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>C1</name> + <message> + <location filename="main.cpp" line="230"/> + <source>test TRANSLATOR comment (3)</source> + <comment>C1</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>D</name> + <message> + <location filename="main.cpp" line="55"/> + <source>test</source> + <comment>D</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Gui::MainWindow</name> + <message> + <location filename="main.cpp" line="163"/> + <source>More bla</source> + <comment>Gui::MainWindow</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="141"/> + <source>task 161186</source> + <comment>QObject</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>X::D</name> + <message> + <location filename="main.cpp" line="95"/> + <source>foo</source> + <comment>D</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="115"/> + <source>Bla</source> + <comment>X::D</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>X::F</name> + <message> + <location filename="main.cpp" line="128"/> + <source>inline function</source> + <comment>X::F</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>X::Y::C</name> + <message> + <location filename="main.cpp" line="111"/> + <source>Bla</source> + <comment>X::Y::C</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>X::Y::E</name> + <message> + <location filename="main.cpp" line="119"/> + <location filename="main.cpp" line="120"/> + <source>Bla</source> + <comment>X::Y::E</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>ico::foo::A</name> + <message> + <location filename="main.cpp" line="140"/> + <source>myfoo</source> + <comment>ico::foo::A</comment> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp new file mode 100644 index 000000000..9f6bc5b56 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp @@ -0,0 +1,184 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the autotests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "finddialog.h" +#include "mainwindow.h" +#include "tabbedbrowser.h" +#include "helpwindow.h" + +#include <QTextBrowser> +#include <QTextCursor> +#include <QStatusBar> +#include <QLineEdit> +#include <QDateTime> +#include <QGridLayout> + +CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent) + : QStandardItemModel(rows, columns, parent) +{} +QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, const QVariant &value, + int hits, Qt::MatchFlags flags) const +{ + if (flags == Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) + flags |= Qt::MatchCaseSensitive; + + return QStandardItemModel::match(start, role, value, hits, flags); +} + +FindDialog::FindDialog(MainWindow *parent) + : QDialog(parent) +{ + contentsWidget = new QWidget(this); + ui.setupUi(contentsWidget); + ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind)); + + QVBoxLayout *l = new QVBoxLayout(this); + l->setMargin(0); + l->setSpacing(0); + l->addWidget(contentsWidget); + + lastBrowser = 0; + onceFound = false; + findExpr.clear(); + + sb = new QStatusBar(this); + l->addWidget(sb); + + sb->showMessage(tr("Enter the text you are looking for.")); + + connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked())); + connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject())); +} + +FindDialog::~FindDialog() +{ +} + +void FindDialog::findButtonClicked() +{ + doFind(ui.radioForward->isChecked()); +} + +void FindDialog::doFind(bool forward) +{ + QTextBrowser *browser = static_cast<QTextBrowser*>(mainWindow()->browsers()->currentBrowser()); + sb->clearMessage(); + + if (ui.comboFind->currentText() != findExpr || lastBrowser != browser) + onceFound = false; + findExpr = ui.comboFind->currentText(); + + QTextDocument::FindFlags flags = 0; + + if (ui.checkCase->isChecked()) + flags |= QTextDocument::FindCaseSensitively; + + if (ui.checkWords->isChecked()) + flags |= QTextDocument::FindWholeWords; + + QTextCursor c = browser->textCursor(); + if (!c.hasSelection()) { + if (forward) + c.movePosition(QTextCursor::Start); + else + c.movePosition(QTextCursor::End); + + browser->setTextCursor(c); + } + + QTextDocument::FindFlags options; + if (forward == false) + flags |= QTextDocument::FindBackward; + + QTextCursor found = browser->document()->find(findExpr, c, flags); + if (found.isNull()) { + if (onceFound) { + if (forward) + statusMessage(tr("Search reached end of the document")); + else + statusMessage(tr("Search reached start of the document")); + } else { + statusMessage(tr( "Text not found" )); + } + } else { + browser->setTextCursor(found); + } + onceFound |= !found.isNull(); + lastBrowser = browser; +} + +bool FindDialog::hasFindExpression() const +{ + return !findExpr.isEmpty(); +} + +void FindDialog::statusMessage(const QString &message) +{ + if (isVisible()) + sb->showMessage(message); + else + static_cast<MainWindow*>(parent())->statusBar()->showMessage(message, 2000); +} + +MainWindow *FindDialog::mainWindow() const +{ + return static_cast<MainWindow*>(parentWidget()); +} + +void FindDialog::reset() +{ + ui.comboFind->setFocus(); + ui.comboFind->lineEdit()->setSelection( + 0, ui.comboFind->lineEdit()->text().length()); + + QString s = QApplication::translate("QCoreApplication", "with comment", "comment"); + QString s = QApplication::translate("QCoreApplication", "empty comment", ""); + QString s = QApplication::translate("QCoreApplication", "null comment", 0); + QString s = tr("null comment"); + + QString s = QApplication::translate("QCoreApplication", "encoding, using QCoreApplication", 0, QCoreApplication::UnicodeUTF8); + QString s = QApplication::translate("QCoreApplication", "encoding, using QApplication", 0, QApplication::UnicodeUTF8); + + QString s = QApplication::translate("KÃ¥ntekst", "encoding, using QApplication", 0, QApplication::UnicodeUTF8); + +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp new file mode 100644 index 000000000..6f9220cd1 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -0,0 +1,345 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! +int main(char **argv, int argc) +{ + Size size = QSize(1,1); +} + +QString qt_detectRTLLanguage() +{ + return QApplication::tr("QT_LAYOUT_DIRECTION", + "Translate this string to the string 'LTR' in left-to-right" + " languages or to 'RTL' in right-to-left languages (such as Hebrew" + " and Arabic) to get proper widget layout.") == QLatin1String("RTL"); +} + + +class Dialog2 : public QDialog +{ + Q_OBJECT + void func(); + void func3(); + int getCount() const { return 2; } + +}; + +void Dialog2::func() +{ + int n = getCount(); + tr("%n files", "plural form", n); + tr("%n cars", 0, n); + tr("&Find %n cars", 0, n); + tr("Search in %n items?", 0, n); + tr("%1. Search in %n items?", 0, n); + tr("Age: %1"); + tr("There are %n house(s)", "Plurals and function call", getCount()); + + + + + QCoreApplication::translate("Plurals, QCoreApplication", "%n house(s)", "Plurals and identifier", QCoreApplication::UnicodeUTF8, n); + QCoreApplication::translate("Plurals, QCoreApplication", "%n car(s)", "Plurals and literal number", QCoreApplication::UnicodeUTF8, 1); + QCoreApplication::translate("Plurals, QCoreApplication", "%n horse(s)", "Plurals and function call", QCoreApplication::UnicodeUTF8, getCount()); + + + + + + + + + QTranslator trans; + trans.translate("QTranslator", "Simple"); + trans.translate("QTranslator", "Simple", 0); + trans.translate("QTranslator", "Simple with comment", "with comment"); + trans.translate("QTranslator", "Plural without comment", 0, 1); + trans.translate("QTranslator", "Plural with comment", "comment 1", n); + trans.translate("QTranslator", "Plural with comment", "comment 2", getCount()); + + + + + + + + + + + + +} + + + + +/* This is actually a test of how many alternative ways a struct/class can be found in a source file. + * Due to the simple parser in lupdate, it will actually not treat the remaining lines in the define + * as a macro, which is a case the 'Tok_Class' parser block might not consider, and it might loop infinite + * if it just tries to fetch the next token until it gets a '{' or a ';'. Another pitfall is that the + * context of tr("func3") might not be parsed, it won't resume normal evaluation until the '{' after the function + * signature. + * + */ +typedef struct S_ +{ +int a; +} S, *SPtr; +class ForwardDecl; + + +#define FT_DEFINE_SERVICE( name ) \ + typedef struct FT_Service_ ## name ## Rec_ \ + FT_Service_ ## name ## Rec ; \ + typedef struct FT_Service_ ## name ## Rec_ \ + const * FT_Service_ ## name ; \ + struct FT_Service_ ## name ## Rec_ + + +/* removing this comment will break this test */ + +void Dialog2::func3() +{ + tr("func3"); +} + + + + +namespace Gui { class BaseClass {}; } + + +class TestClass : QObject { + Q_OBJECT + + + inline QString inlineFunc1() { + return tr("inline function", "TestClass"); + } + + QString inlineFunc2() { + return tr("inline function 2", "TestClass"); + } + + static inline QString staticInlineFunc() { + return tr("static inline function", "TestClass"); + } + + class NoQObject : public Gui::BaseClass { + public: + inline QString hello() { return QString("hello"); } + + }; + +}; + + +class Testing : QObject { + Q_OBJECT + + inline QString f1() { + //: this is an extra comment for the translator + return tr("extra-commented string"); + return tr("not extra-commented string"); + /*: another extra-comment */ + return tr("another extra-commented string"); + /*: blah! */ + return QApplication::translate("scope", "works in translate, too", "blabb", 0); + } + +}; + +//: extra comment for NOOP +//: which spans multiple lines +QT_TRANSLATE_NOOP("scope", "string") // 4.4 says the line of this is at the next statement +//: extra comment for NOOP3 +QT_TRANSLATE_NOOP3_UTF8("scope", "string", "comment") // 4.4 doesn't see this + +QT_TRANSLATE_NOOP("scope", "string " // this is an interleaved comment + "continuation on next line") + + +class TestingTake17 : QObject { + Q_OBJECT + + int function(void) + { + //: random comment + //= this_is_an_id + //~ loc-layout_id fooish_bar + //~ po-ignore_me totally foo-barred nonsense + tr("something cool"); + + tr("less cool"); + + //= another_id + 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); + + + +class YetAnotherTest : QObject { + Q_OBJECT + + int function(void) + { + // + //: + //= + //~ + //# + //============= + //~~~~~~~~~~~~~ + //::::::::::::: + tr("nothing"); + } +}; + + + +//: This is a message without a source string +QString test = qtTrId("yet_another_id"); + + + +// QTBUG-9276: context in static initializers +class Bogus : QObject { + Q_OBJECT + + static const char * const s_strings[]; +}; + +const char * const Bogus::s_strings[] = { + QT_TR_NOOP("this should be in Bogus") +}; + +const char * const Bogus::s_strings[SIZE] = { + QT_TR_NOOP("this should be in Bogus") +}; + +void bogosity() +{ + // no spaces here. test collateral damage from ignoring equal sign + Class::member=QObject::tr("just QObject"); +} + + + +namespace Internal { + +class Message : public QObject +{ + Q_OBJECT +public: + Message(QObject *parent = 0); +}; + +} // The temporary closing of the namespace triggers the problem + +namespace Internal { + +static inline QString message1() +{ + return Message::tr("message1"); // Had no namespace +} + +static inline QString message2() +{ + return Message::tr("message2"); // Already had namespace +} + +} + + + +// QTBUG-11426: operator overloads +class LotsaFun : public QObject +{ + Q_OBJECT +public: + int operator<<(int left, int right); +}; + +int LotsaFun::operator<<(int left, int right) +{ + tr("this is inside operator<<"); + return left << right; +} + + + +// QTBUG-12683: define in re-opened namespace +namespace NameSchpace { + +class YetMoreFun : public QObject +{ + Q_OBJECT +public: + void funStuff(); +}; + +} + +namespace NameSchpace { + +#define somevar 1 + +void YetMoreFun::funStuff() +{ + tr("funStuff!"); +} + +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro new file mode 100644 index 000000000..bbabdfba2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro @@ -0,0 +1,4 @@ +SOURCES += main.cpp +SOURCES += finddialog.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result new file mode 100644 index 000000000..f73fc6477 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -0,0 +1,370 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name></name> + <message id="this_a_id"> + <location filename="main.cpp" line="226"/> + <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="230"/> + <source>This needs to be here. Really.</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + <extra-some>thing</extra-some> + </message> + <message id="yet_another_id"> + <location filename="main.cpp" line="254"/> + <source></source> + <extracomment>This is a message without a source string</extracomment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Bogus</name> + <message> + <location filename="main.cpp" line="266"/> + <location filename="main.cpp" line="270"/> + <source>this should be in Bogus</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Dialog2</name> + <message numerus="yes"> + <location filename="main.cpp" line="70"/> + <source>%n files</source> + <comment>plural form</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="main.cpp" line="71"/> + <source>%n cars</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="main.cpp" line="72"/> + <source>&Find %n cars</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="main.cpp" line="73"/> + <source>Search in %n items?</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="main.cpp" line="74"/> + <source>%1. Search in %n items?</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message> + <location filename="main.cpp" line="75"/> + <source>Age: %1</source> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="main.cpp" line="76"/> + <source>There are %n house(s)</source> + <comment>Plurals and function call</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message> + <location filename="main.cpp" line="143"/> + <source>func3</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>FindDialog</name> + <message> + <location filename="finddialog.cpp" line="85"/> + <source>Enter the text you are looking for.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="135"/> + <source>Search reached end of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="137"/> + <source>Search reached start of the document</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="139"/> + <source>Text not found</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="175"/> + <source>null comment</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Internal::Message</name> + <message> + <location filename="main.cpp" line="296"/> + <source>message1</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="301"/> + <source>message2</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>KÃ¥ntekst</name> + <message utf8="true"> + <location filename="finddialog.cpp" line="180"/> + <source>encoding, using QApplication</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>LotsaFun</name> + <message> + <location filename="main.cpp" line="318"/> + <source>this is inside operator<<</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>NameSchpace::YetMoreFun</name> + <message> + <location filename="main.cpp" line="342"/> + <source>funStuff!</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Plurals, QCoreApplication</name> + <message numerus="yes"> + <location filename="main.cpp" line="81"/> + <source>%n house(s)</source> + <comment>Plurals and identifier</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="main.cpp" line="82"/> + <source>%n car(s)</source> + <comment>Plurals and literal number</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="main.cpp" line="83"/> + <source>%n horse(s)</source> + <comment>Plurals and function call</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> +</context> +<context> + <name>QApplication</name> + <message> + <location filename="main.cpp" line="51"/> + <source>QT_LAYOUT_DIRECTION</source> + <comment>Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout.</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QCoreApplication</name> + <message> + <location filename="finddialog.cpp" line="172"/> + <source>with comment</source> + <comment>comment</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="173"/> + <source>empty comment</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="174"/> + <source>null comment</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="177"/> + <source>encoding, using QCoreApplication</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="finddialog.cpp" line="178"/> + <source>encoding, using QApplication</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="276"/> + <source>just QObject</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QTranslator</name> + <message> + <location filename="main.cpp" line="93"/> + <location filename="main.cpp" line="94"/> + <source>Simple</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="95"/> + <source>Simple with comment</source> + <comment>with comment</comment> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="main.cpp" line="96"/> + <source>Plural without comment</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="main.cpp" line="97"/> + <source>Plural with comment</source> + <comment>comment 1</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="main.cpp" line="98"/> + <source>Plural with comment</source> + <comment>comment 2</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> +</context> +<context> + <name>TestClass</name> + <message> + <location filename="main.cpp" line="157"/> + <source>inline function</source> + <comment>TestClass</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="161"/> + <source>inline function 2</source> + <comment>TestClass</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="165"/> + <source>static inline function</source> + <comment>TestClass</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Testing</name> + <message> + <location filename="main.cpp" line="182"/> + <source>extra-commented string</source> + <extracomment>this is an extra comment for the translator</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="183"/> + <source>not extra-commented string</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="185"/> + <source>another extra-commented string</source> + <extracomment>another extra-comment</extracomment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>TestingTake17</name> + <message id="this_is_an_id"> + <location filename="main.cpp" line="211"/> + <source>something cool</source> + <extracomment>random comment</extracomment> + <translation type="unfinished"></translation> + <extra-po-ignore_me>totally foo-barred nonsense</extra-po-ignore_me> + <extra-loc-layout_id>fooish_bar</extra-loc-layout_id> + </message> + <message> + <location filename="main.cpp" line="213"/> + <source>less cool</source> + <translation type="unfinished"></translation> + </message> + <message id="another_id"> + <location filename="main.cpp" line="216"/> + <source>even more cool</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>YetAnotherTest</name> + <message> + <location filename="main.cpp" line="247"/> + <source>nothing</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>scope</name> + <message numerus="yes"> + <location filename="main.cpp" line="187"/> + <source>works in translate, too</source> + <comment>blabb</comment> + <extracomment>blah!</extracomment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message> + <location filename="main.cpp" line="194"/> + <source>string</source> + <extracomment>extra comment for NOOP which spans multiple lines</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="196"/> + <source>string</source> + <comment>comment</comment> + <extracomment>extra comment for NOOP3</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="198"/> + <source>string continuation on next line</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt new file mode 100644 index 000000000..d4ebe4992 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt @@ -0,0 +1,7 @@ +.*/lupdate/testdata/good/parsecpp2/main.cpp:51: Excess closing brace .* +.*/lupdate/testdata/good/parsecpp2/main.cpp:55: Excess closing brace .* +.*/lupdate/testdata/good/parsecpp2/main.cpp:61: Excess closing brace .* +.*/lupdate/testdata/good/parsecpp2/main.cpp:65: Excess closing brace .* +.*/lupdate/testdata/good/parsecpp2/main.cpp:120: //% cannot be used with tr\(\) / QT_TR_NOOP\(\)\. Ignoring +.*/lupdate/testdata/good/parsecpp2/main.cpp:123: //% cannot be used with translate\(\) / QT_TRANSLATE_NOOP\(\)\. Ignoring +.*/lupdate/testdata/good/parsecpp2/main.cpp:126: Discarding unconsumed meta data diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp new file mode 100644 index 000000000..cf39ef354 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +// nothing here + +// sickness: multi-\ +line c++ comment } (with brace) + +#define This is a closing brace } which was ignored +} // complain here + +#define This is another \ + closing brace } which was ignored +} // complain here + +#define This is another /* comment in } define */\ + something /* comment ) + spanning {multiple} lines */ \ + closing brace } which was ignored +} // complain here + +#define This is another // comment in } define \ + something } comment +} // complain here + + + +// Nested class in same file +class TopLevel { + Q_OBJECT + + class Nested; +}; + +class TopLevel::Nested { + void foo(); +}; + +TopLevel::Nested::foo() +{ + TopLevel::tr("TopLevel"); +} + +// Nested class in other file +#include "main.h" + +class TopLevel2::Nested { + void foo(); +}; + +TopLevel2::Nested::foo() +{ + TopLevel2::tr("TopLevel2"); +} + + + +namespace NameSpace { +class ToBeUsed; +} + +// using statement before class definition +using NameSpace::ToBeUsed; + +class NameSpace::ToBeUsed { + Q_OBJECT + void caller(); +}; + +void ToBeUsed::caller() +{ + tr("NameSpace::ToBeUsed"); +} + + + +// QTBUG-11818 +//% "Foo" +QObject::tr("Hello World"); +QObject::tr("Hello World"); +//% "Bar" +QApplication::translate("QObject", "Hello World"); +QApplication::translate("QObject", "Hello World"); +//% "Baz" +clear = me; +QObject::tr("Hello World"); diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h new file mode 100644 index 000000000..ee41232cf --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +class TopLevel2 { + Q_OBJECT + + class Nested; +}; + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main2.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main2.cpp new file mode 100644 index 000000000..a9290608a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main2.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +// nothing here + +// sickness: multi-\ +line c++ comment } (with brace) + +#define This is a closing brace } which was ignored +} // complain here + +#define This is another \ + closing brace } which was ignored +} // complain here + +#define This is another /* comment in } define */\ + something /* comment ) + spanning {multiple} lines */ \ + closing brace } which was ignored +} // complain here + +#define This is another // comment in } define \ + something } comment +} // complain here + +char somestring[] = "\ + continued\n\ + here and \"quoted\" to activate\n"; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main3.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main3.cpp new file mode 100644 index 000000000..d08af6205 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main3.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +// nothing here + +// sickness: multi-\ +line c++ comment } (with brace) + +#define This is a closing brace } which was ignored +} // complain here + +#define This is another \ + closing brace } which was ignored +} // complain here + +#define This is another /* comment in } define */\ + something /* comment ) + spanning {multiple} lines */ \ + closing brace } which was ignored +} // complain here + +#define This is another // comment in } define \ + something } comment +} // complain here + +char somestring[] = "\ + continued\n\ + here and \"quoted\" to activate\n"; + + NSString *scriptSource = @"\ + on SetupNewMail(theRecipientAddress, theSubject, theContent, theAttachmentPath)\n\ + tell application \"Mail\" to activate\n\ + tell application \"Mail\"\n\ + set theMessage to make new outgoing message with properties {visible:true, subject:theSubject, content:theContent}\n\ + tell theMessage\n\ + make new to recipient at end of to recipients with properties {address:theRecipientAddress}\n\ + end tell\n\ + tell content of theMessage\n\ + make new attachment with properties {file name:theAttachmentPath} at after last paragraph\n\ + end tell\n\ + end tell\n\ + end SetupNewMail\n"; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro new file mode 100644 index 000000000..759bea068 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro @@ -0,0 +1,3 @@ +SOURCES = main.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result new file mode 100644 index 000000000..806f56f99 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>NameSpace::ToBeUsed</name> + <message> + <location filename="main.cpp" line="113"/> + <source>NameSpace::ToBeUsed</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="120"/> + <location filename="main.cpp" line="121"/> + <location filename="main.cpp" line="123"/> + <location filename="main.cpp" line="124"/> + <location filename="main.cpp" line="127"/> + <source>Hello World</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>TopLevel</name> + <message> + <location filename="main.cpp" line="82"/> + <source>TopLevel</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>TopLevel2</name> + <message> + <location filename="main.cpp" line="94"/> + <source>TopLevel2</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejava/main.java b/tests/auto/linguist/lupdate/testdata/good/parsejava/main.java new file mode 100644 index 000000000..710588986 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejava/main.java @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +package com.trolltech.examples; + +public class I18N extends QDialog { + + private class MainWindow extends QMainWindow { + private String foo = tr("pack class class"); + + //: extra comment for t-tor + private String bar = tr("pack class class extra"); + + public MainWindow(QWidget parent) { + super(parent); + + listWidget = new QListWidget(); + listWidget.addItem(tr("pack class class method")); + + } + } + + public I18N(QWidget parent) { + super(parent, new Qt.WindowFlags(Qt.WindowType.WindowStaysOnTopHint)); + + tr("pack class method"); + + tr("QT_LAYOUT_DIRECTION", + "Translate this string to the string 'LTR' in left-to-right" + + " languages or to 'RTL' in right-to-left languages (such as Hebrew" + + " and Arabic) to get proper widget layout."); + + tr("%n files", "plural form", n); + tr("%n cars", null, n); + tr("Age: %1"); + tr("There are %n house(s)", "Plurals and function call", getCount()); + + QTranslator trans; + trans.translate("QTranslator", "Simple"); + trans.translate("QTranslator", "Simple", null); + trans.translate("QTranslator", "Simple with comment", "with comment"); + trans.translate("QTranslator", "Plural without comment", null, 1); + trans.translate("QTranslator", "Plural with comment", "comment 1", n); + trans.translate("QTranslator", "Plural with comment", "comment 2", getCount()); + + /*: with extra comment! */ + QCoreApplication.translate("Plurals, QCoreApplication", "%n house(s)", "Plurals and identifier", n); + + // FIXME: This will fail. + //QApplication.tr("QT_LAYOUT_DIRECTION", "scoped to qapp"); + + } + +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro new file mode 100644 index 000000000..657b535e2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro @@ -0,0 +1,3 @@ +SOURCES += main.java + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejava/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.ts.result new file mode 100644 index 000000000..0ce600c1b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.ts.result @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>Plurals, QCoreApplication</name> + <message numerus="yes"> + <location filename="main.java" line="88"/> + <source>%n house(s)</source> + <comment>Plurals and identifier</comment> + <extracomment>with extra comment!</extracomment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> +</context> +<context> + <name>QTranslator</name> + <message> + <location filename="main.java" line="80"/> + <location filename="main.java" line="81"/> + <source>Simple</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.java" line="82"/> + <source>Simple with comment</source> + <comment>with comment</comment> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="main.java" line="83"/> + <source>Plural without comment</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="main.java" line="84"/> + <source>Plural with comment</source> + <comment>comment 1</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="main.java" line="85"/> + <source>Plural with comment</source> + <comment>comment 2</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> +</context> +<context> + <name>com.trolltech.examples.I18N</name> + <message> + <location filename="main.java" line="67"/> + <source>pack class method</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.java" line="72"/> + <source>QT_LAYOUT_DIRECTION</source> + <comment>Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout.</comment> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="main.java" line="74"/> + <source>%n files</source> + <comment>plural form</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message numerus="yes"> + <location filename="main.java" line="75"/> + <source>%n cars</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> + <message> + <location filename="main.java" line="76"/> + <source>Age: %1</source> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="main.java" line="77"/> + <source>There are %n house(s)</source> + <comment>Plurals and function call</comment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> +</context> +<context> + <name>com.trolltech.examples.I18N$MainWindow</name> + <message> + <location filename="main.java" line="50"/> + <source>pack class class</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.java" line="53"/> + <source>pack class class extra</source> + <extracomment>extra comment for t-tor</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.java" line="59"/> + <source>pack class class method</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> 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> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs2/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsejs2/expectedoutput.txt new file mode 100644 index 000000000..d6c977fa7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs2/expectedoutput.txt @@ -0,0 +1,29 @@ +.*/lupdate/testdata/good/parsejs2/main.js:3: qsTranslate\(\) requires at least two arguments. +.*/lupdate/testdata/good/parsejs2/main.js:4: qsTranslate\(\) requires at least two arguments. +.*/lupdate/testdata/good/parsejs2/main.js:5: qsTranslate\(\): both arguments must be literal strings. +.*/lupdate/testdata/good/parsejs2/main.js:6: qsTranslate\(\): both arguments must be literal strings. +.*/lupdate/testdata/good/parsejs2/main.js:7: qsTranslate\(\): both arguments must be literal strings. +.*/lupdate/testdata/good/parsejs2/main.js:9: QT_TRANSLATE_NOOP\(\) requires at least two arguments. +.*/lupdate/testdata/good/parsejs2/main.js:10: QT_TRANSLATE_NOOP\(\) requires at least two arguments. +.*/lupdate/testdata/good/parsejs2/main.js:11: QT_TRANSLATE_NOOP\(\): both arguments must be literal strings. +.*/lupdate/testdata/good/parsejs2/main.js:12: QT_TRANSLATE_NOOP\(\): both arguments must be literal strings. +.*/lupdate/testdata/good/parsejs2/main.js:13: QT_TRANSLATE_NOOP\(\): both arguments must be literal strings. +.*/lupdate/testdata/good/parsejs2/main.js:15: qsTr\(\) requires at least one argument. +.*/lupdate/testdata/good/parsejs2/main.js:16: qsTr\(\): text to translate must be a literal string. +.*/lupdate/testdata/good/parsejs2/main.js:18: QT_TR_NOOP\(\) requires at least one argument. +.*/lupdate/testdata/good/parsejs2/main.js:19: QT_TR_NOOP\(\): text to translate must be a literal string. +.*/lupdate/testdata/good/parsejs2/main.js:21: qsTrId\(\) requires at least one argument. +.*/lupdate/testdata/good/parsejs2/main.js:22: qsTrId\(\): identifier must be a literal string. +.*/lupdate/testdata/good/parsejs2/main.js:24: QT_TRID_NOOP\(\) requires at least one argument. +.*/lupdate/testdata/good/parsejs2/main.js:25: QT_TRID_NOOP\(\): identifier must be a literal string. +.*/lupdate/testdata/good/parsejs2/main.js:27: Unexpected character in meta string +.*/lupdate/testdata/good/parsejs2/main.js:28: Unexpected character in meta string +.*/lupdate/testdata/good/parsejs2/main.js:29: Unterminated meta string +.*/lupdate/testdata/good/parsejs2/main.js:30: Unterminated meta string +.*/lupdate/testdata/good/parsejs2/main.js:33: //% cannot be used with qsTranslate\(\). Ignoring +.*/lupdate/testdata/good/parsejs2/main.js:35: //% cannot be used with QT_TRANSLATE_NOOP\(\). Ignoring +.*/lupdate/testdata/good/parsejs2/main.js:37: //% cannot be used with qsTr\(\). Ignoring +.*/lupdate/testdata/good/parsejs2/main.js:39: //% cannot be used with QT_TR_NOOP\(\). Ignoring +.*/lupdate/testdata/good/parsejs2/main.js:42: Discarding unconsumed meta data +.*/lupdate/testdata/good/parsejs2/main.js:44: Discarding unconsumed meta data +.*/lupdate/testdata/good/parsejs2/main.js:46: Discarding unconsumed meta data diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs2/main.js b/tests/auto/linguist/lupdate/testdata/good/parsejs2/main.js new file mode 100644 index 000000000..ea0295772 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs2/main.js @@ -0,0 +1,56 @@ +// This script exercises lupdate errors and warnings. + +qsTranslate(); +qsTranslate(10); +qsTranslate(10, 20); +qsTranslate("10", 20); +qsTranslate(10, "20"); + +QT_TRANSLATE_NOOP(); +QT_TRANSLATE_NOOP(10); +QT_TRANSLATE_NOOP(10, 20); +QT_TRANSLATE_NOOP("10", 20); +QT_TRANSLATE_NOOP(10, "20"); + +qsTr(); +qsTr(10); + +QT_TR_NOOP(); +QT_TR_NOOP(10); + +qsTrId(); +qsTrId(10); + +QT_TRID_NOOP(); +QT_TRID_NOOP(10); + +//% This is wrong +//% "This is not wrong" This is wrong +//% "I forgot to close the meta string +//% "Being evil \ + +//% "Should cause a warning" +qsTranslate("FooContext", "Hello"); +//% "Should cause a warning" +QT_TRANSLATE_NOOP("FooContext", "World"); +//% "Should cause a warning" +qsTr("Hello"); +//% "Should cause a warning" +QT_TR_NOOP("World"); + +//: This comment will be discarded. +Math.sin(1); +//= id_foobar +Math.cos(2); +//~ underflow False +Math.tan(3); + +/* +Not tested for now, because these should perhaps not cause +translation entries to be generated at all; see QTBUG-11843. + +//= qtn_foo +qsTrId("qtn_foo"); +//= qtn_bar +QT_TRID_NOOP("qtn_bar"); +*/ diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs2/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsejs2/project.pro new file mode 100644 index 000000000..d549039c4 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs2/project.pro @@ -0,0 +1,3 @@ +SOURCES += main.js + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsejs2/project.ts.result new file mode 100644 index 000000000..bfa1b3d61 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs2/project.ts.result @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>FooContext</name> + <message> + <location filename="main.js" line="33"/> + <source>Hello</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="35"/> + <source>World</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>main</name> + <message> + <location filename="main.js" line="37"/> + <source>Hello</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="39"/> + <source>World</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/main.js b/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/main.js new file mode 100644 index 000000000..aa510c1ae --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/main.js @@ -0,0 +1,29 @@ +// No context specified, default should be used. +qsTr("One"); +QT_TR_NOOP("Two"); + +// TRANSLATOR Foo +qsTr("Three"); +QT_TR_NOOP("Four"); + +// TRANSLATOR Bar +qsTr("Five"); + +/* + TRANSLATOR Baz + This is a comment to the translator. +*/ +QT_TR_NOOP("Six"); + +// TRANSLATOR Foo.Bar +qsTr("Seven"); + +/* TRANSLATOR Bar::Baz */ +QT_TR_NOOP("Eight"); + +// qsTranslate() context is not affected. +qsTranslate("Foo", "Nine"); + +// Empty context. +// TRANSLATOR +qsTr("Ten"); diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/project.pro new file mode 100644 index 000000000..d549039c4 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/project.pro @@ -0,0 +1,3 @@ +SOURCES += main.js + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/project.ts.result new file mode 100644 index 000000000..18407b2f8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejscontexts/project.ts.result @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name></name> + <message> + <location filename="main.js" line="29"/> + <source>Ten</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Bar</name> + <message> + <location filename="main.js" line="10"/> + <source>Five</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Bar::Baz</name> + <message> + <location filename="main.js" line="22"/> + <source>Eight</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Baz</name> + <message> + <location filename="main.js" line="12"/> + <source></source> + <comment>This is a comment to the translator.</comment> + <translation></translation> + </message> + <message> + <location filename="main.js" line="16"/> + <source>Six</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Foo</name> + <message> + <location filename="main.js" line="6"/> + <source>Three</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="7"/> + <source>Four</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="25"/> + <source>Nine</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Foo.Bar</name> + <message> + <location filename="main.js" line="19"/> + <source>Seven</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>main</name> + <message> + <location filename="main.js" line="2"/> + <source>One</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="3"/> + <source>Two</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml new file mode 100644 index 000000000..c966fa112 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml @@ -0,0 +1,100 @@ +import QtQuick 1.0 + +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"); + } +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro new file mode 100644 index 000000000..1040e2227 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro @@ -0,0 +1,3 @@ +SOURCES += main.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 new file mode 100644 index 000000000..484390298 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result @@ -0,0 +1,200 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name></name> + <message id="qtn_foo_bar"> + <location filename="main.qml" line="89"/> + <source></source> + <translation type="unfinished"></translation> + </message> + <message id="qtn_needle"> + <location filename="main.qml" line="91"/> + <source></source> + <translation type="unfinished"></translation> + </message> + <message id="qtn_haystack"> + <location filename="main.qml" line="91"/> + <source></source> + <translation type="unfinished"></translation> + </message> + <message id="qtn_bar_baz" numerus="yes"> + <location filename="main.qml" line="95"/> + <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> + <message id="qtn_baz_biz"> + <location filename="main.qml" line="98"/> + <source>Source text</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>BarContext</name> + <message> + <location filename="main.qml" line="19"/> + <source>See other comment</source> + <extracomment>My second comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="42"/> + <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"/> + <source>This string also has an identifier</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="85"/> + <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.qml" line="28"/> + <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"/> + <source>The comment had no effect, really</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="66"/> + <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.qml" line="6"/> + <source>Two</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="10"/> + <source>Goodbye</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="34"/> + <source>I really love C++</source> + <extracomment>Another C-style comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="54"/> + <source>I refuse to comment on that</source> + <translation type="unfinished"></translation> + </message> + <message id="id_babar"> + <location filename="main.qml" line="81"/> + <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.qml" line="5"/> + <source>One</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="9"/> + <source>Hello</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="13"/> + <source>One</source> + <comment>not the same one</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="16"/> + <source>See comment</source> + <extracomment>My first comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="23"/> + <source>The comment explains it all</source> + <extracomment>My third comment spans two lines.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="31"/> + <source>I love C++</source> + <extracomment>C-style comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="38"/> + <source>Qt is the best</source> + <extracomment>C-style comment, followed by another one.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="45"/> + <source>The comment had no effect</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="51"/> + <source>No comment to your comment</source> + <translation type="unfinished"></translation> + </message> + <message id="id_foo"> + <location filename="main.qml" line="57"/> + <source>This string has an identifier</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="63"/> + <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.qml" line="73"/> + <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.qml" line="83"/> + <source>This string has disambiguation</source> + <comment>Disambiguation</comment> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="main.qml" line="87"/> + <source>This string contains plurals</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro new file mode 100644 index 000000000..fa56972dd --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro @@ -0,0 +1,3 @@ +FORMS += project.ui + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result new file mode 100644 index 000000000..b27d23991 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>FindDialog</name> + <message> + <location filename="project.ui" line="55"/> + <source>Qt Assistant - Finn text</source> + <translation type="unfinished"></translation> + </message> + <message utf8="true"> + <location filename="project.ui" line="58"/> + <source>Finn tekst - Der Bjørn möchte auch mal.</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui new file mode 100644 index 000000000..55c1c3a0a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui @@ -0,0 +1,72 @@ +<ui version="4.0" > + <author></author> +<comment>********************************************************************* +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <exportmacro></exportmacro> + <class>FindDialog</class> + <widget class="QWidget" name="FindDialog" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>172</height> + </rect> + </property> + <property name="windowTitle" > + <string>Qt Assistant - Finn text</string> + </property> + <property name="height" > + <string>Finn tekst - Der Bjørn möchte auch mal.</string> + </property> + </widget> + <tabstops> + <tabstop>comboFind</tabstop> + <tabstop>checkWords</tabstop> + <tabstop>checkCase</tabstop> + <tabstop>radioForward</tabstop> + <tabstop>radioBackward</tabstop> + <tabstop>findButton</tabstop> + <tabstop>closeButton</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp b/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp new file mode 100644 index 000000000..91d0c81dd --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +QString foo() +{ + QCoreApplication::translate("Foo","XXX","YYY"); +} + +Foo::Foo() +{ + tr("CTOR"); +} + +void Foo::bar() +{ + tr("BAR"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro b/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro new file mode 100644 index 000000000..759bea068 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro @@ -0,0 +1,3 @@ +SOURCES = main.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result new file mode 100644 index 000000000..e3569218e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>Foo</name> + <message> + <location filename="main.cpp" line="45"/> + <source>XXX</source> + <comment>YYY</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="50"/> + <source>CTOR</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="55"/> + <source>BAR</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp b/tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp new file mode 100644 index 000000000..4f388bd97 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "Platform-independent file"); +} + + + + +void func2() { +#ifdef Q_OS_WIN + QApplication::tr("Kind", "Windows only, see Type"); +#else + QApplication::tr("Type", "Not used on windows, see Kind"); +#endif + +} + + + +void stringconcatenation() +{ + QApplication::tr("One string," + " three" + " lines"); + + QApplication::tr("a backslash followed by newline \ +should be ignored \ +and the next line should be syntactically considered to be \ +on the same line"); + +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro new file mode 100644 index 000000000..c96859bdb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro @@ -0,0 +1,3 @@ +SOURCES += main.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.ts.result new file mode 100644 index 000000000..4d695e84c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.ts.result @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>QApplication</name> + <message> + <location filename="main.cpp" line="47"/> + <source>Hello world</source> + <comment>Platform-independent file</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="55"/> + <source>Kind</source> + <comment>Windows only, see Type</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="57"/> + <source>Type</source> + <comment>Not used on windows, see Kind</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="66"/> + <source>One string, three lines</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="70"/> + <source>a backslash followed by newline should be ignored and the next line should be syntactically considered to be on the same line</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/main.cpp new file mode 100644 index 000000000..e99f1e241 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "Platform-independent file"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/main_mac.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_mac.cpp new file mode 100644 index 000000000..a9321fdd0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_mac.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello macworld", "mac-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/main_unix.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_unix.cpp new file mode 100644 index 000000000..e7b465807 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_unix.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello unixworld", "unix-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/main_win.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_win.cpp new file mode 100644 index 000000000..052137194 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_win.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello windowsworld", "Windows-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro new file mode 100644 index 000000000..0e920f99d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro @@ -0,0 +1,31 @@ +# Try to reference a variable that does not exist: +MYVAR=$$THIS_VARIABLE_IS_NOT_DEFINED + +SOURCES += main.cpp + +win32 { + SOURCES += main_win.cpp +} + +unix { + SOURCES += main_unix.cpp +} + +mac { + SOURCES += main_mac.cpp +} + +SOURCES += wildcard/main*.cpp \ +# yadiyada it should also parse the next line + wildcard*.cpp + + +DEPENDPATH = vpaths/dependpath + +# The purpose of this test is to test expansion of environment variables, +# and to test if the DEPENDPATH variable is considered correctly. +if (exists($$member($$(PATH), 0))) { + SOURCES += main_dependpath.cpp +} + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.ts.result new file mode 100644 index 000000000..556ca073d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.ts.result @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>QApplication</name> + <message> + <location filename="main.cpp" line="47"/> + <source>Hello world</source> + <comment>Platform-independent file</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_mac.cpp" line="47"/> + <source>Hello macworld</source> + <comment>mac-only file</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_unix.cpp" line="47"/> + <source>Hello unixworld</source> + <comment>unix-only file</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main_win.cpp" line="47"/> + <source>Hello windowsworld</source> + <comment>Windows-only file</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="wildcard/main1.cpp" line="47"/> + <source>Hello world</source> + <comment>wildcard/main1.cpp</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="wildcard/mainfile.cpp" line="47"/> + <source>Hello world</source> + <comment>wildcard/main2.cpp</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="wildcard1.cpp" line="47"/> + <source>Hello world</source> + <comment>wildcard1.cpp</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="wildcard99.cpp" line="47"/> + <source>Hello world</source> + <comment>wildcard99.cpp</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QCoreApplication</name> + <message> + <location filename="vpaths/dependpath/main_dependpath.cpp" line="48"/> + <source>Hello from a DEPENDPATH</source> + <comment>See if the DEPENDPATH thing works</comment> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/vpaths/dependpath/main_dependpath.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/vpaths/dependpath/main_dependpath.cpp new file mode 100644 index 000000000..577b6d9df --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/vpaths/dependpath/main_dependpath.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +int main(int argc, char **argv) +{ + QCoreApplication::tr("Hello from a DEPENDPATH", "See if the DEPENDPATH thing works"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/main1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/main1.cpp new file mode 100644 index 000000000..5673da5b6 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/main1.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "wildcard/main1.cpp"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/mainfile.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/mainfile.cpp new file mode 100644 index 000000000..4327db448 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/mainfile.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "wildcard/main2.cpp"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard1.cpp new file mode 100644 index 000000000..1545f823a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard1.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "wildcard1.cpp"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard99.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard99.cpp new file mode 100644 index 000000000..3c8b1ed7e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard99.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "wildcard99.cpp"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/a b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a new file mode 100644 index 000000000..64f00c9e4 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +QString func() +{ + return QLineEdit::tr("a"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp new file mode 100644 index 000000000..a43623e0a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +QString func() +{ + return QLineEdit::tr("a.cpp"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/b b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b new file mode 100644 index 000000000..e53e4a6a8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +QString func() +{ + return QLineEdit::tr("b"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp new file mode 100644 index 000000000..8927f2a80 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +QString func() +{ + return QLineEdit::tr("b.cpp"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/e b/tests/auto/linguist/lupdate/testdata/good/proparsing2/e new file mode 100644 index 000000000..453d10075 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/e @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +QString func() +{ + return QLineEdit::tr("e"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp new file mode 100644 index 000000000..eff872475 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +QString func() +{ + return QLineEdit::tr("f/g.cpp"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/files-cc.txt b/tests/auto/linguist/lupdate/testdata/good/proparsing2/files-cc.txt new file mode 100644 index 000000000..5bd8d03dd --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/files-cc.txt @@ -0,0 +1 @@ +a.cpp b.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro new file mode 100644 index 000000000..3dc420858 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro @@ -0,0 +1,33 @@ +# This is to test if quoted elements with spaces are treated as elements (and not splitted up due +# to the spaces.) +# It also tries to verify the behaviour of combining quoted and non-quoted elements with literals. +# + +QUOTED = $$quote(variable with spaces) +VERSIONAB = "a.b" +VAB = $$split(VERSIONAB, ".") +V += $$VAB +V += $$QUOTED + +# this is just to make p4 happy with no spaces in filename +SOURCES += $$member(V,0,1) +V2 = $$member(V,2) +V2S = $$split(V2, " ") +SOURCES += $$join(V2S,"_") +message($$SOURCES) +# SOURCES += [a, b, variable_with_spaces] + +LIST = d e f +L2 = x/$$LIST/g.cpp +SOURCES += $$L2 +# SOURCES += [x/d, e, f/g.cpp] + +QUOTEDEXTRA = x/$$QUOTED/z +Q3 = $$split(QUOTEDEXTRA, " ") +SOURCES += $$Q3 +# SOURCES += [x/variable, with, spaces/z] + +win32: SOURCES += $$system(type files-cc.txt) +unix: SOURCES += $$system(cat files-cc.txt) + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.ts.result new file mode 100644 index 000000000..3714d9bd8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.ts.result @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>QLineEdit</name> + <message> + <location filename="a" line="44"/> + <source>a</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="a.cpp" line="44"/> + <source>a.cpp</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="b" line="44"/> + <source>b</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="b.cpp" line="44"/> + <source>b.cpp</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="e" line="44"/> + <source>e</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="f/g.cpp" line="44"/> + <source>f/g.cpp</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="spaces/z" line="44"/> + <source>spaces/z</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="variable_with_spaces" line="44"/> + <source>variable with spaces</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="with" line="44"/> + <source>with</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="x/d" line="44"/> + <source>x/d</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="x/variable" line="44"/> + <source>x/variable</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z b/tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z new file mode 100644 index 000000000..94255b1d4 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +QString func() +{ + return QLineEdit::tr("spaces/z"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces b/tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces new file mode 100644 index 000000000..99259ab1d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +QString func() +{ + return QLineEdit::tr("variable with spaces"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/with b/tests/auto/linguist/lupdate/testdata/good/proparsing2/with new file mode 100644 index 000000000..2b23f4a7c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/with @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +QString func() +{ + return QLineEdit::tr("with"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d new file mode 100644 index 000000000..672901c07 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +QString func() +{ + return QLineEdit::tr("x/d"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable new file mode 100644 index 000000000..f7c7ed052 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +QString func() +{ + return QLineEdit::tr("x/variable"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp new file mode 100644 index 000000000..3a95835ce --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "top-level wildcard"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp new file mode 100644 index 000000000..f9ee8f449 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "top-level direct"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro new file mode 100644 index 000000000..6bfe751f4 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro @@ -0,0 +1,5 @@ +SOURCES += file*.cpp filter.cpp non-existing.cpp + +include(sub/sub.pri) + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result new file mode 100644 index 000000000..edc2fcb81 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>QApplication</name> + <message> + <location filename="file1.cpp" line="47"/> + <source>Hello world</source> + <comment>top-level wildcard</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="filter.cpp" line="47"/> + <source>Hello world</source> + <comment>top-level direct</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="sub/subfile1.cpp" line="47"/> + <source>Hello world</source> + <comment>nested wildcard</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="sub/subfilter.cpp" line="47"/> + <source>Hello world</source> + <comment>nested direct</comment> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri new file mode 100644 index 000000000..a6079f93e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri @@ -0,0 +1,3 @@ +VPATH += $$PWD + +SOURCES += sub/subfile?.cpp subfilter.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp new file mode 100644 index 000000000..a4d4b7d15 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "nested wildcard"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp new file mode 100644 index 000000000..686175f29 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "nested direct"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/common.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/common.pri new file mode 100644 index 000000000..ba3169dd9 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/common.pri @@ -0,0 +1 @@ +include(main.pri) diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp new file mode 100644 index 000000000..e99f1e241 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "Platform-independent file"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.pri new file mode 100644 index 000000000..a8d4a2ba2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.pri @@ -0,0 +1,5 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += $$PWD/main.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/mac.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/mac.pri new file mode 100644 index 000000000..549eab5e4 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/mac.pri @@ -0,0 +1,5 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += $$PWD/main_mac.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/main_mac.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/main_mac.cpp new file mode 100644 index 000000000..a9321fdd0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/main_mac.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello macworld", "mac-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro new file mode 100644 index 000000000..5e23538b9 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro @@ -0,0 +1,9 @@ +include(win/win.pri) +include(mac/mac.pri) +include(unix/unix.pri) +include (common/common.pri) # Important: keep the space before the '(' +include(relativity/relativity.pri) + +message($$SOURCES) + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.ts.result new file mode 100644 index 000000000..e01c53310 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.ts.result @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>QApplication</name> + <message> + <location filename="common/main.cpp" line="47"/> + <source>Hello world</source> + <comment>Platform-independent file</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="mac/main_mac.cpp" line="47"/> + <source>Hello macworld</source> + <comment>mac-only file</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="relativity/relativity.cpp" line="47"/> + <source>relativity.pri</source> + <comment>Platform-independent file</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="unix/main_unix.cpp" line="47"/> + <source>Hello unixworld</source> + <comment>unix-only file</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="win/main_win.cpp" line="47"/> + <source>Hello windowsworld</source> + <comment>Windows-only file</comment> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp new file mode 100644 index 000000000..747105c49 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("relativity.pri", "Platform-independent file"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.pri new file mode 100644 index 000000000..42658f0c6 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.pri @@ -0,0 +1,3 @@ +# Lets test how well the proparser can walk the tree of includes... + +include(sub/sub.pri) diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub/sub.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub/sub.pri new file mode 100644 index 000000000..17055a7e7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub/sub.pri @@ -0,0 +1 @@ +include(../sub2/sub2.pri) diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub2/sub2.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub2/sub2.pri new file mode 100644 index 000000000..e2876b10f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub2/sub2.pri @@ -0,0 +1,2 @@ +SOURCES += $$PWD/../relativity.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/main_unix.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/main_unix.cpp new file mode 100644 index 000000000..e7b465807 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/main_unix.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello unixworld", "unix-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/unix.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/unix.pri new file mode 100644 index 000000000..99777d7c9 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/unix.pri @@ -0,0 +1,5 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += $$PWD/main_unix.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/main_win.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/main_win.cpp new file mode 100644 index 000000000..052137194 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/main_win.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello windowsworld", "Windows-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/win.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/win.pri new file mode 100644 index 000000000..742417cb0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/win.pri @@ -0,0 +1,5 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += $$PWD/main_win.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro new file mode 100644 index 000000000..88f243571 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = sub1 diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.ts.result new file mode 100644 index 000000000..a6972bd03 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.ts.result @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>QApplication</name> + <message> + <location filename="sub1/main.cpp" line="47"/> + <source>Hello world</source> + <comment>Platform-independent file</comment> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp new file mode 100644 index 000000000..e99f1e241 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "Platform-independent file"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro new file mode 100644 index 000000000..df18c5a69 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro @@ -0,0 +1,3 @@ +SOURCES += main.cpp + +TRANSLATIONS = ../project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro new file mode 100644 index 000000000..3f6c64360 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro @@ -0,0 +1,2 @@ +SOURCES += main.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp new file mode 100644 index 000000000..e99f1e241 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "Platform-independent file"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/lupdatecmd new file mode 100644 index 000000000..b7e12cc45 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/lupdatecmd @@ -0,0 +1 @@ +lupdate project.pro -ts project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro new file mode 100644 index 000000000..a1863b665 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro @@ -0,0 +1 @@ +SOURCES += main_mac.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/main_mac.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/main_mac.cpp new file mode 100644 index 000000000..a9321fdd0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/main_mac.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello macworld", "mac-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro new file mode 100644 index 000000000..f75a46276 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = win mac unix common diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.ts.result new file mode 100644 index 000000000..6621de99c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.ts.result @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>QApplication</name> + <message> + <location filename="win/main_win.cpp" line="47"/> + <source>Hello windowsworld</source> + <comment>Windows-only file</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="mac/main_mac.cpp" line="47"/> + <source>Hello macworld</source> + <comment>mac-only file</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="unix/main_unix.cpp" line="47"/> + <source>Hello unixworld</source> + <comment>unix-only file</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="common/main.cpp" line="47"/> + <source>Hello world</source> + <comment>Platform-independent file</comment> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/main_unix.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/main_unix.cpp new file mode 100644 index 000000000..e7b465807 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/main_unix.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello unixworld", "unix-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro new file mode 100644 index 000000000..71b1a2252 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro @@ -0,0 +1 @@ +SOURCES += main_unix.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/main_win.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/main_win.cpp new file mode 100644 index 000000000..052137194 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/main_win.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello windowsworld", "Windows-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro new file mode 100644 index 000000000..afd719711 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro @@ -0,0 +1 @@ +SOURCES += main_win.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_full/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/recurse_full/expectedoutput.txt new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_full/expectedoutput.txt diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_full/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/recurse_full/lupdatecmd new file mode 100644 index 000000000..40987e2db --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_full/lupdatecmd @@ -0,0 +1,2 @@ +TRANSLATION: project.ts project_sub.ts +cd ../../subdirs_full diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_full/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/recurse_full/project.ts.result new file mode 100644 index 000000000..7d9a6f484 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_full/project.ts.result @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>subdir1</name> + <message> + <location filename="subdir1/main.cpp" line="45"/> + <source>minimal test</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>subsub1</name> + <message> + <location filename="subdir2/subsub1/main.cpp" line="45"/> + <source>minimal test</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_full/project_sub.ts.result b/tests/auto/linguist/lupdate/testdata/good/recurse_full/project_sub.ts.result new file mode 100644 index 000000000..cddb9632f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_full/project_sub.ts.result @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<defaultcodec>ISO-8859-2</defaultcodec> +<context> + <name>subsub2</name> + <message> + <location filename="subdir2/subsub2/main.cpp" line="45"/> + <source>minimal test</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/expectedoutput.txt new file mode 100644 index 000000000..fd7a158d3 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/expectedoutput.txt @@ -0,0 +1,2 @@ +lupdate warning: TS files from command line will override TRANSLATIONS in project\.pro\. +lupdate warning: TS files from command line prevent recursing into .*/subdir2/subsub2/subsub2\.pro\. diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/lupdatecmd new file mode 100644 index 000000000..33296c3a2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/lupdatecmd @@ -0,0 +1,3 @@ +TRANSLATION: project.ts project_sub.ts +cd ../../subdirs_full +lupdate project.pro -ts project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/project.ts.result new file mode 100644 index 000000000..7d9a6f484 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/project.ts.result @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>subdir1</name> + <message> + <location filename="subdir1/main.cpp" line="45"/> + <source>minimal test</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>subsub1</name> + <message> + <location filename="subdir2/subsub1/main.cpp" line="45"/> + <source>minimal test</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/project_sub.ts.before b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/project_sub.ts.before new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/project_sub.ts.before diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/project_sub.ts.result b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/project_sub.ts.result new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts/project_sub.ts.result diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts_join/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts_join/expectedoutput.txt new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts_join/expectedoutput.txt diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts_join/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts_join/lupdatecmd new file mode 100644 index 000000000..628acc0dc --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts_join/lupdatecmd @@ -0,0 +1,2 @@ +cd ../../subdirs_full +lupdate subdir1/subdir1.pro subdir2/subsub1/subsub1.pro -ts project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts_join/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts_join/project.ts.result new file mode 100644 index 000000000..7d9a6f484 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_full_ts_join/project.ts.result @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>subdir1</name> + <message> + <location filename="subdir1/main.cpp" line="45"/> + <source>minimal test</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>subsub1</name> + <message> + <location filename="subdir2/subsub1/main.cpp" line="45"/> + <source>minimal test</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_part/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/recurse_part/expectedoutput.txt new file mode 100644 index 000000000..808db1838 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_part/expectedoutput.txt @@ -0,0 +1 @@ +lupdate warning: no TS files specified\. Only diagnostics will be produced for 'project\.pro'\. diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_part/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/recurse_part/lupdatecmd new file mode 100644 index 000000000..3e15bc7f6 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_part/lupdatecmd @@ -0,0 +1,2 @@ +TRANSLATION: project.ts project_sub.ts +cd ../../subdirs_part diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_part/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/recurse_part/project.ts.before new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_part/project.ts.before diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_part/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/recurse_part/project.ts.result new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_part/project.ts.result diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_part/project_sub.ts.result b/tests/auto/linguist/lupdate/testdata/good/recurse_part/project_sub.ts.result new file mode 100644 index 000000000..cddb9632f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_part/project_sub.ts.result @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<defaultcodec>ISO-8859-2</defaultcodec> +<context> + <name>subsub2</name> + <message> + <location filename="subdir2/subsub2/main.cpp" line="45"/> + <source>minimal test</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/expectedoutput.txt new file mode 100644 index 000000000..b90439003 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/expectedoutput.txt @@ -0,0 +1 @@ +lupdate warning: TS files from command line prevent recursing into .*/subdir2/subsub2/subsub2\.pro\. diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/lupdatecmd new file mode 100644 index 000000000..41bfcecf3 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/lupdatecmd @@ -0,0 +1,3 @@ +TRANSLATION: project.ts project_sub.ts +cd ../../subdirs_part +lupdate project.pro -ts project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/project.ts.result new file mode 100644 index 000000000..7d9a6f484 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/project.ts.result @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>subdir1</name> + <message> + <location filename="subdir1/main.cpp" line="45"/> + <source>minimal test</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>subsub1</name> + <message> + <location filename="subdir2/subsub1/main.cpp" line="45"/> + <source>minimal test</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/project_sub.ts.before b/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/project_sub.ts.before new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/project_sub.ts.before diff --git a/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/project_sub.ts.result b/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/project_sub.ts.result new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/recurse_part_ts/project_sub.ts.result diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/reloutput/lupdatecmd new file mode 100644 index 000000000..90f609bd8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/lupdatecmd @@ -0,0 +1 @@ +TRANSLATION: translations/project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp b/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp new file mode 100644 index 000000000..d8320bfd2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro b/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro new file mode 100644 index 000000000..4e2e6ada7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/project.pro @@ -0,0 +1,3 @@ +SOURCES += main.cpp + +TRANSLATIONS = translations/project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/reloutput/translations/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/reloutput/translations/project.ts.result new file mode 100644 index 000000000..e398701c9 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/reloutput/translations/project.ts.result @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>QApplication</name> + <message> + <location filename="../main.cpp" line="47"/> + <source>Hello world</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/respfile/lupdatecmd new file mode 100644 index 000000000..6f198ab83 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/lupdatecmd @@ -0,0 +1,2 @@ +# Add the command that lupdate should run here. If it can't find anything it will default to +lupdate -silent @sources.lst -ts @tsfiles.lst diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/respfile/project.ts.result new file mode 100644 index 000000000..3a864a214 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/project.ts.result @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>Dialog2</name> + <message> + <location filename="source1.cpp" line="47"/> + <source>func1</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="source2.cpp" line="47"/> + <source>func2</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp b/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp new file mode 100644 index 000000000..a91d3b4b8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +void Dialog2::func3() +{ + tr("func1"); +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/source2.cpp b/tests/auto/linguist/lupdate/testdata/good/respfile/source2.cpp new file mode 100644 index 000000000..677cc4ca1 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/source2.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +void Dialog2::func3() +{ + tr("func2"); +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/sources.lst b/tests/auto/linguist/lupdate/testdata/good/respfile/sources.lst new file mode 100644 index 000000000..430937e49 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/sources.lst @@ -0,0 +1,2 @@ +source1.cpp +source2.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/tsfiles.lst b/tests/auto/linguist/lupdate/testdata/good/respfile/tsfiles.lst new file mode 100644 index 000000000..f3eb71f1c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/respfile/tsfiles.lst @@ -0,0 +1 @@ +project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro new file mode 100644 index 000000000..fa56972dd --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro @@ -0,0 +1,3 @@ +FORMS += project.ui + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.before new file mode 100644 index 000000000..f06c22ca8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.before @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<!DOCTYPE TS><TS version="1.1"> +<context> + <name>FindDialog</name> + <message> + <location filename="project.ui" line="20"/> + <source>Test similarity</source> + <translation type="unfinished">Test likhet (test1)</translation> + </message> + <message> + <location filename="project.ui" line="23"/> + <source>Similarity should have kicked in here!</source> + <translation type="unfinished">Test likhet (test2)</translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result new file mode 100644 index 000000000..6bc565c1e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>FindDialog</name> + <message> + <source>Test similarity</source> + <translation type="obsolete">Test likhet (test1)</translation> + </message> + <message> + <location filename="project.ui" line="20"/> + <source>This should not be considered to be more or less equal to the corresponding one in the TS file.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="project.ui" line="23"/> + <source>Here, similarity should kick in!</source> + <oldsource>Similarity should have kicked in here!</oldsource> + <translation type="unfinished">Test likhet (test2)</translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui new file mode 100644 index 000000000..a5f8e9f79 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui @@ -0,0 +1,26 @@ +<ui version="4.0" > + <author></author> + <comment><!-- +********************************************************************* +** +** Do not change the location (linenumber) of the <string> elements in this file! +** That will make the test break! +** +** If you need to add some tests, please add them to the end of the file! +** +** +********************************************************************* +--> +</comment> + <exportmacro></exportmacro> + <class>FindDialog</class> + <widget class="QWidget" name="FindDialog" > + <property name="test1"> + <!-- If the sourcetext is not similar to the vernacular sourcetext, mark the old one as obsolete and the new one as unfinished --> + <string>This should not be considered to be more or less equal to the corresponding one in the TS file.</string> + </property> + <property name="test2"> + <string>Here, similarity should kick in!</string> + </property> + </widget> +</ui> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp new file mode 100644 index 000000000..0a193bc9a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QDebug> + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + QTranslator translator; + translator.load("whitespace"); + app.installTranslator(&translator); + + QObject::tr("\nnewline at the start"); + QObject::tr("newline at the end\n"); + QObject::tr("newline and space at the end\n "); + QObject::tr("space and newline at the end \n"); + QObject::tr("\tTab at the start and newline at the end\n"); + QObject::tr("\n\tnewline and tab at the start"); + QObject::tr(" \tspace and tab at the start"); + QObject::tr(" space_first"); + QObject::tr("space_last "); + return app.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui new file mode 100644 index 000000000..5135dfed0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui @@ -0,0 +1,74 @@ +<ui version="4.0" > + <author></author> +<comment> +********************************************************************* +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +********************************************************************* +</comment> + <exportmacro></exportmacro> + <class>FindDialog</class> + <widget class="QWidget" name="FindDialog" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>172</height> + </rect> + </property> + <property name="windowTitle" > + <string>Qt Assistant - Finn text</string> + </property> + <property name="height" > + <string>Finn tekst</string> + </property> + </widget> + <tabstops> + <tabstop>comboFind</tabstop> + <tabstop>checkWords</tabstop> + <tabstop>checkCase</tabstop> + <tabstop>radioForward</tabstop> + <tabstop>radioBackward</tabstop> + <tabstop>findButton</tabstop> + <tabstop>closeButton</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++ new file mode 100644 index 000000000..8a5ce148f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++ @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + QApplication::translate("text/c++", "test"); + return app.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp new file mode 100644 index 000000000..c774af13f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + QApplication::translate("text/cpp", "test"); + return app.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx new file mode 100644 index 000000000..a4d144f02 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + QApplication::translate("text/cxx", "test"); + return app.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp new file mode 100644 index 000000000..b5a9ca8d2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "finddialog.h" +#include "mainwindow.h" +#include "tabbedbrowser.h" +#include "helpwindow.h" + +#include <QTextBrowser> +#include <QTextCursor> +#include <QStatusBar> +#include <QLineEdit> +#include <QDateTime> +#include <QGridLayout> + +FindDialog::FindDialog(MainWindow *parent) + : QDialog(parent) +{ + sb->showMessage(tr("Enter the text you want to find.")); +} + +void FindDialog::doFind(bool forward) +{ + QTextCursor found = browser->document()->find(findExpr, c, flags); + if (found.isNull()) { + if (onceFound) { + if (forward) + statusMessage(tr("Search reached end of the document")); + else + statusMessage(tr("Search reached start of the document")); + } else { + statusMessage(tr( "Text not found" )); + } + } +} diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_full/project.pro b/tests/auto/linguist/lupdate/testdata/subdirs_full/project.pro new file mode 100644 index 000000000..1f744a722 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_full/project.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs +SUBDIRS = subdir1 subdir2/subdir2.pro + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir1/main.cpp b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir1/main.cpp new file mode 100644 index 000000000..97b646ffb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir1/main.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +QString foo() +{ + QCoreApplication::translate("subdir1","minimal test"); +} diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir1/subdir1.pro b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir1/subdir1.pro new file mode 100644 index 000000000..28dcadcbf --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir1/subdir1.pro @@ -0,0 +1 @@ +SOURCES += main.cpp diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subdir2.pro b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subdir2.pro new file mode 100644 index 000000000..f8d03df4b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subdir2.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = subsub1 subsub2 diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub1/main.cpp b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub1/main.cpp new file mode 100644 index 000000000..cc78f8a5d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub1/main.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +QString foo() +{ + QCoreApplication::translate("subsub1","minimal test"); +} diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub1/subsub1.pro b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub1/subsub1.pro new file mode 100644 index 000000000..28dcadcbf --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub1/subsub1.pro @@ -0,0 +1 @@ +SOURCES += main.cpp diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/main.cpp b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/main.cpp new file mode 100644 index 000000000..ff061beba --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/main.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +QString foo() +{ + QCoreApplication::translate("subsub2","minimal test"); +} diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/subsub2.pro b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/subsub2.pro new file mode 100644 index 000000000..349922287 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_full/subdir2/subsub2/subsub2.pro @@ -0,0 +1,4 @@ +SOURCES += main.cpp + +TRANSLATIONS = ../../project_sub.ts +CODECFORTR = ISO-8859-2 diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_part/project.pro b/tests/auto/linguist/lupdate/testdata/subdirs_part/project.pro new file mode 100644 index 000000000..d803c37bb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_part/project.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = subdir1 subdir2/subdir2.pro diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir1/main.cpp b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir1/main.cpp new file mode 100644 index 000000000..97b646ffb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir1/main.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +QString foo() +{ + QCoreApplication::translate("subdir1","minimal test"); +} diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir1/subdir1.pro b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir1/subdir1.pro new file mode 100644 index 000000000..28dcadcbf --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir1/subdir1.pro @@ -0,0 +1 @@ +SOURCES += main.cpp diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subdir2.pro b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subdir2.pro new file mode 100644 index 000000000..f8d03df4b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subdir2.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = subsub1 subsub2 diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub1/main.cpp b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub1/main.cpp new file mode 100644 index 000000000..cc78f8a5d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub1/main.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +QString foo() +{ + QCoreApplication::translate("subsub1","minimal test"); +} diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub1/subsub1.pro b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub1/subsub1.pro new file mode 100644 index 000000000..28dcadcbf --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub1/subsub1.pro @@ -0,0 +1 @@ +SOURCES += main.cpp diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/main.cpp b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/main.cpp new file mode 100644 index 000000000..ff061beba --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/main.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +QString foo() +{ + QCoreApplication::translate("subsub2","minimal test"); +} diff --git a/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/subsub2.pro b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/subsub2.pro new file mode 100644 index 000000000..349922287 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/subdirs_part/subdir2/subsub2/subsub2.pro @@ -0,0 +1,4 @@ +SOURCES += main.cpp + +TRANSLATIONS = ../../project_sub.ts +CODECFORTR = ISO-8859-2 |