From f08b60f4ca52d525c1dc9890cb0c6661ee34b069 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Jun 2010 16:36:04 +0200 Subject: don't complain multiple times about same abuse of //% meta strings Reviewed-by: Kent Hansen Task-number: QTBUG-11818 --- .../lupdate/testdata/good/parsecpp2/expectedoutput.txt | 2 ++ .../auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp | 13 +++++++++++++ .../lupdate/testdata/good/parsecpp2/project.ts.result | 12 ++++++++++++ tools/linguist/lupdate/cpp.cpp | 3 +++ 4 files changed, 30 insertions(+) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt index 195c0e6..959938c 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 feb885c..06e6fe0 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 6f48e27..806f56f 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 @@ + QObject + + + + + + + Hello World + + + + TopLevel diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 028a64f..25e162f 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1858,6 +1858,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &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 &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 &inclusions) case Tok_Semicolon: prospectiveContext.clear(); prefix.clear(); + sourcetext.clear(); extracomment.clear(); msgid.clear(); extra.clear(); -- cgit v0.12