diff --git a/tools/chatgui/tests/test_gui_language.cpp b/tools/chatgui/tests/test_gui_language.cpp index 61300403a..d3e5c2aa7 100644 --- a/tools/chatgui/tests/test_gui_language.cpp +++ b/tools/chatgui/tests/test_gui_language.cpp @@ -185,7 +185,7 @@ private slots: QFile file(QStringLiteral(GUI_TS_DIR) + "/chatgui_" + language + ".ts"); QVERIFY(file.open(QIODevice::ReadOnly)); QXmlStreamReader xml(&file); - QString source; + QString source, context; int count = 0; const QRegularExpression placeholders("%(?:L?[1-9][0-9]?|n)"); auto parameters = [&](const QString& text) { @@ -198,18 +198,21 @@ private slots: while (!xml.atEnd()) { xml.readNext(); if (!xml.isStartElement()) continue; + if (xml.name() == QLatin1String("name")) context = xml.readElementText(); if (xml.name() == QLatin1String("source")) source = xml.readElementText(); if (xml.name() != QLatin1String("translation")) continue; QVERIFY(!xml.attributes().hasAttribute("type")); const QString translation = xml.readElementText(); QVERIFY2(!translation.isEmpty(), qPrintable(source)); QCOMPARE(parameters(translation), parameters(source)); - QCOMPARE(QCoreApplication::translate("ChatGui", source.toUtf8().constData()), translation); + QVERIFY(!context.isEmpty()); + QCOMPARE(QCoreApplication::translate(context.toUtf8().constData(), source.toUtf8().constData()), translation); if (language == "en") QCOMPARE(translation, source); count++; } QVERIFY2(!xml.hasError(), qPrintable(xml.errorString())); QVERIFY(count > 0); + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "embedded catalog verified language=%s messages=%d", qPrintable(language), count); qApp->removeTranslator(&translator); } }