From ccbae6677e52f2b02cbd43608777f93c2b663a80 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 24 Nov 2014 23:57:48 +0100 Subject: Fix warning in correct uses of QCoreApplication::translate It was emitting the warning for "Unsupported Latin1" in the case it was a valid plural form too Change-Id: I22c9c15d50488810e3ff5d7b132aebd994b08ebf Reviewed-by: Oswald Buddenhagen --- src/linguist/lupdate/cpp.cpp | 4 +++- .../linguist/lupdate/testdata/good/parsecpp/expectedoutput.txt | 5 +++++ tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp | 2 +- .../linguist/lupdate/testdata/good/parsecpp/project.ts.result | 8 ++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecpp/expectedoutput.txt diff --git a/src/linguist/lupdate/cpp.cpp b/src/linguist/lupdate/cpp.cpp index b8bb1e859..6f720f27c 100644 --- a/src/linguist/lupdate/cpp.cpp +++ b/src/linguist/lupdate/cpp.cpp @@ -1397,6 +1397,7 @@ STRING(QCoreApplication); STRING(UnicodeUTF8); STRING(DefaultCodec); STRING(CodecForTr); +STRING(Latin1); bool CppParser::matchEncoding() { @@ -1411,7 +1412,8 @@ bool CppParser::matchEncoding() yyTok = getToken(); return true; } - yyMsg() << qPrintable(LU::tr("Unsupported encoding Latin1\n")); + if (yyWord == strLatin1) + yyMsg() << qPrintable(LU::tr("Unsupported encoding Latin1\n")); return false; } diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp/expectedoutput.txt new file mode 100644 index 000000000..c35c086c8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/expectedoutput.txt @@ -0,0 +1,5 @@ +.*/lupdate/testdata/good/parsecpp/finddialog.cpp:77: Qualifying with unknown namespace/class ::FindDialog +.*/lupdate/testdata/good/parsecpp/finddialog.cpp:127: Qualifying with unknown namespace/class ::FindDialog +.*/lupdate/testdata/good/parsecpp/finddialog.cpp:167: Qualifying with unknown namespace/class ::FindDialog +.*/lupdate/testdata/good/parsecpp/finddialog.cpp:173: Unsupported encoding Latin1 +lupdate warning: Message with id 'yet_another_id' has no source. diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp index 3b1556a29..3833fac3b 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp @@ -170,7 +170,7 @@ void FindDialog::reset() QString s = QApplication::translate("QCoreApplication", "encoding, using QApplication", 0, QApplication::UnicodeUTF8); QString s = QApplication::translate("Kåntekst", "encoding, using QApplication", 0, QApplication::UnicodeUTF8); - + QString s = QApplication::translate("QTranslator", "Key", "disambiguation", QCoreApplication::Latin1); } diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index 8bb7fadd8..c0a4a83b2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -259,6 +259,14 @@ backslashed \ stuff. QTranslator + + + Key + disambiguation + + + + -- cgit v1.2.3