From f343c6efac717e3a58d74614c7eb0b84ed380099 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 7 Jun 2010 19:54:51 +0200 Subject: fix translations from some header files being omitted add the containing directories of all files specified on the command line to the list of project roots. otherwise, the strings from headers which are included before being encountered on the command line will be omitted. Task-number: QTBUG-10345 --- .../lupdate/testdata/good/cmdline_order/a.h | 42 +++++++++++++++++++++ .../lupdate/testdata/good/cmdline_order/b.h | 44 ++++++++++++++++++++++ .../lupdate/testdata/good/cmdline_order/lupdatecmd | 1 + .../testdata/good/cmdline_order/project.ts.result | 20 ++++++++++ tools/linguist/lupdate/main.cpp | 1 + 5 files changed, 108 insertions(+) create mode 100644 tests/auto/linguist/lupdate/testdata/good/cmdline_order/a.h create mode 100644 tests/auto/linguist/lupdate/testdata/good/cmdline_order/b.h create mode 100644 tests/auto/linguist/lupdate/testdata/good/cmdline_order/lupdatecmd create mode 100644 tests/auto/linguist/lupdate/testdata/good/cmdline_order/project.ts.result 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 0000000..7059132 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/a.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2010 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 0000000..ce3e1a2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/b.h @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 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 0000000..edd91f7 --- /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 0000000..6028cbb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/project.ts.result @@ -0,0 +1,20 @@ + + + + + aaa + + + some text + + + + + bbb + + + some text + + + + diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index b2bfd7c..274e33c 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -627,6 +627,7 @@ int main(int argc, char **argv) } } else { sourceFiles << QDir::cleanPath(fi.absoluteFilePath());; + projectRoots.insert(fi.absolutePath() + QLatin1Char('/')); } numFiles++; } -- cgit v0.12