summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-06-07 17:54:51 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-06-07 17:59:17 (GMT)
commitf343c6efac717e3a58d74614c7eb0b84ed380099 (patch)
treefc00a95c731156bffa1af064578dfa3f501c2ea2
parent66e4bcd6249477f5a1e05911443c9a8e73f18738 (diff)
downloadQt-f343c6efac717e3a58d74614c7eb0b84ed380099.zip
Qt-f343c6efac717e3a58d74614c7eb0b84ed380099.tar.gz
Qt-f343c6efac717e3a58d74614c7eb0b84ed380099.tar.bz2
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
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/cmdline_order/a.h42
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/cmdline_order/b.h44
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/cmdline_order/lupdatecmd1
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/cmdline_order/project.ts.result20
-rw-r--r--tools/linguist/lupdate/main.cpp1
5 files changed, 108 insertions, 0 deletions
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 @@
+<?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/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++;
}