Fix warning in correct uses of QCoreApplication::translate
authorAlbert Astals Cid <aacid@kde.org>
Mon, 24 Nov 2014 22:57:48 +0000 (23:57 +0100)
committerAlbert Astals Cid <aacid@kde.org>
Fri, 6 Mar 2015 18:53:33 +0000 (18:53 +0000)
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 <oswald.buddenhagen@theqtcompany.com>
src/linguist/lupdate/cpp.cpp
tests/auto/linguist/lupdate/testdata/good/parsecpp/expectedoutput.txt [new file with mode: 0644]
tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp
tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result

index b8bb1e8..6f720f2 100644 (file)
@@ -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 (file)
index 0000000..c35c086
--- /dev/null
@@ -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.
index 3b1556a..3833fac 100644 (file)
@@ -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);
 }
 
 
index 8bb7fad..c0a4a83 100644 (file)
@@ -259,6 +259,14 @@ backslashed \ stuff.</source>
 </context>
 <context>
     <name>QTranslator</name>
+    <message numerus="yes">
+        <location filename="finddialog.cpp" line="173"/>
+        <source>Key</source>
+        <comment>disambiguation</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
     <message>
         <location filename="main.cpp" line="85"/>
         <location filename="main.cpp" line="86"/>