summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-06-29 16:36:04 +0200
committerJason McDonald <jason.mcdonald@nokia.com>2010-06-30 11:08:36 +1000
commit7bf890a45139c06a66eb362dec9fa6e17205291d (patch)
tree86ff75b63ca513253298f594555b22c82e719056
parent0fef3b8463a3d3b9bb0e4e08b964794eb40bd55d (diff)
don't complain multiple times about same abuse of //% meta strings
Reviewed-by: Kent Hansen Task-number: QTBUG-11818 (cherry picked from commit f08b60f4ca52d525c1dc9890cb0c6661ee34b069)
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp13
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result12
-rw-r--r--tools/linguist/lupdate/cpp.cpp3
4 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt
index 195c0e65c5..959938c350 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt
@@ -2,3 +2,5 @@
.*/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
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp
index feb885c4b1..06e6fe0e54 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp
@@ -112,3 +112,16 @@ 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/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result
index 6f48e27021..806f56f99c 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result
@@ -10,6 +10,18 @@
</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"/>
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp
index b3e7e84f80..97fa04cd52 100644
--- a/tools/linguist/lupdate/cpp.cpp
+++ b/tools/linguist/lupdate/cpp.cpp
@@ -1858,6 +1858,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
gotctx:
recordMessage(line, context, text, comment, extracomment, msgid, extra, utf8, plural);
}
+ sourcetext.clear(); // Will have warned about that already
extracomment.clear();
msgid.clear();
extra.clear();
@@ -1913,6 +1914,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
}
recordMessage(line, context, text, comment, extracomment, msgid, extra, utf8, plural);
}
+ sourcetext.clear(); // Will have warned about that already
extracomment.clear();
msgid.clear();
extra.clear();
@@ -2079,6 +2081,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
case Tok_Semicolon:
prospectiveContext.clear();
prefix.clear();
+ sourcetext.clear();
extracomment.clear();
msgid.clear();
extra.clear();