From 7e6c41939624becf6071ee34409e41d079c7f515 Mon Sep 17 00:00:00 2001 From: Tarja Sundqvist Date: Wed, 6 Apr 2022 17:57:36 +0300 Subject: Bump version --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index 3283eb34f..f3c8954d0 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -2,4 +2,4 @@ load(qt_build_config) DEFINES += QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST -MODULE_VERSION = 5.15.9 +MODULE_VERSION = 5.15.10 -- cgit v1.2.3 From 61039d4ba82a9a8c58d8c5b3876a2799f5665334 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 23 Mar 2022 16:56:21 +0100 Subject: lrelease-pro: Take EXTRA_TRANSLATIONS into account The QMake variable EXTRA_TRANSLATIONS contains .ts files that are only to be handled by lrelease but not lupdate. Teach lrelease-pro to understand this variable, but ignore it in lupdate-pro. Fixes: QTBUG-101782 Change-Id: I79e1c669480dc35dc61ecc149fe7ba1bba28ab29 Reviewed-by: Kai Koehne (cherry picked from commit 2641698341456b8905ef1fbd58b51a80a61ef70d) Reviewed-by: Qt CI Bot --- src/linguist/lprodump/main.cpp | 36 +++++++++++++++++++++++++++--------- src/linguist/lrelease-pro/main.cpp | 3 +++ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/linguist/lprodump/main.cpp b/src/linguist/lprodump/main.cpp index f2a3e88a3..e6fd4f02f 100644 --- a/src/linguist/lprodump/main.cpp +++ b/src/linguist/lprodump/main.cpp @@ -104,6 +104,8 @@ static void printUsage() " Trace processing .pro files. Specify twice for more verbosity.\n" " -out \n" " Name of the output file.\n" + " -translations-variables [,,...]\n" + " Comma-separated list of QMake variables containing .ts files.\n" " -version\n" " Display the version of lprodump and exit.\n" )); @@ -272,11 +274,13 @@ static void excludeProjects(const ProFileEvaluator &visitor, QStringList *subPro } static QJsonArray processProjects(bool topLevel, const QStringList &proFiles, + const QStringList &translationsVariables, const QHash &outDirMap, ProFileGlobals *option, QMakeVfs *vfs, QMakeParser *parser, bool *fail); -static QJsonObject processProject(const QString &proFile, ProFileGlobals *option, QMakeVfs *vfs, +static QJsonObject processProject(const QString &proFile, const QStringList &translationsVariables, + ProFileGlobals *option, QMakeVfs *vfs, QMakeParser *parser, ProFileEvaluator &visitor) { QJsonObject result; @@ -304,7 +308,7 @@ static QJsonObject processProject(const QString &proFile, ProFileGlobals *option subProFiles << subPro; } } - QJsonArray subResults = processProjects(false, subProFiles, + QJsonArray subResults = processProjects(false, subProFiles, translationsVariables, QHash(), option, vfs, parser, nullptr); if (!subResults.isEmpty()) @@ -321,6 +325,7 @@ static QJsonObject processProject(const QString &proFile, ProFileGlobals *option } static QJsonArray processProjects(bool topLevel, const QStringList &proFiles, + const QStringList &translationsVariables, const QHash &outDirMap, ProFileGlobals *option, QMakeVfs *vfs, QMakeParser *parser, bool *fail) { @@ -346,16 +351,20 @@ static QJsonArray processProjects(bool topLevel, const QStringList &proFiles, continue; } - QJsonObject prj = processProject(proFile, option, vfs, parser, visitor); + QJsonObject prj = processProject(proFile, translationsVariables, option, vfs, parser, + visitor); setValue(prj, "projectFile", proFile); - if (visitor.contains(QLatin1String("TRANSLATIONS"))) { - QStringList tsFiles; + QStringList tsFiles; + for (const QString &varName : translationsVariables) { + if (!visitor.contains(varName)) + continue; QDir proDir(QFileInfo(proFile).path()); - const QStringList translations = visitor.values(QLatin1String("TRANSLATIONS")); + const QStringList translations = visitor.values(varName); for (const QString &tsFile : translations) tsFiles << proDir.filePath(tsFile); - setValue(prj, "translations", tsFiles); } + if (!tsFiles.isEmpty()) + setValue(prj, "translations", tsFiles); result.append(prj); pro->deref(); } @@ -367,6 +376,7 @@ int main(int argc, char **argv) QCoreApplication app(argc, argv); QStringList args = app.arguments(); QStringList proFiles; + QStringList translationsVariables = { QStringLiteral("TRANSLATIONS") }; QString outDir = QDir::currentPath(); QHash outDirMap; QString outputFilePath; @@ -409,6 +419,14 @@ int main(int argc, char **argv) return 1; } outDir = QDir::cleanPath(QFileInfo(args[i]).absoluteFilePath()); + } else if (arg == QLatin1String("-translations-variables")) { + ++i; + if (i == argc) { + printErr(LD::tr("The -translations-variables option must be followed by a " + "comma-separated list of variable names.\n")); + return 1; + } + translationsVariables = args.at(i).split(QLatin1Char(',')); } else if (arg.startsWith(QLatin1String("-")) && arg != QLatin1String("-")) { printErr(LD::tr("Unrecognized option '%1'.\n").arg(arg)); return 1; @@ -446,8 +464,8 @@ int main(int argc, char **argv) QMakeVfs vfs; QMakeParser parser(0, &vfs, &evalHandler); - QJsonArray results = processProjects(true, proFiles, outDirMap, &option, &vfs, - &parser, &fail); + QJsonArray results = processProjects(true, proFiles, translationsVariables, outDirMap, &option, + &vfs, &parser, &fail); if (fail) return 1; diff --git a/src/linguist/lrelease-pro/main.cpp b/src/linguist/lrelease-pro/main.cpp index 88a9aee18..ffdea7be4 100644 --- a/src/linguist/lrelease-pro/main.cpp +++ b/src/linguist/lrelease-pro/main.cpp @@ -127,6 +127,9 @@ int main(int argc, char **argv) return 1; } + lprodumpOptions << QStringLiteral("-translations-variables") + << QStringLiteral("TRANSLATIONS,EXTRA_TRANSLATIONS"); + const QStringList proFiles = extractProFiles(&inputFiles); if (proFiles.isEmpty()) { printErr(LR::tr("lrelease-pro: No .pro/.pri files given.\n")); -- cgit v1.2.3 From 97a63ed277504bdac0c8085c788521bdce01f65a Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 25 Apr 2022 17:02:12 +0200 Subject: Skip endonym in linguist settings list when not available The settings dialog iterates all members of the QLocale::Language enum, producing an entry for each. It tried to add the endonym of each language to its entry; however, QLocale(language) gets the default locale if there is no CLDR data for the given language; and the default locale's endonym is no use to us. So don't attempt to include the endonym of a language unless the locale from which we get it actually does use the requested language. Also mention why English skips its endonym. Fixes: QTBUG-102832 Change-Id: Ia4583727beb247e4775f443d98089db3f02a17d2 Reviewed-by: Kai Koehne (cherry picked from commit b30768f7714141158b4fa7afd3ae2ad5ca68dceb) Reviewed-by: Edward Welbourne --- src/linguist/linguist/translationsettingsdialog.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/linguist/linguist/translationsettingsdialog.cpp b/src/linguist/linguist/translationsettingsdialog.cpp index 7a1a53585..dc523f8f4 100644 --- a/src/linguist/linguist/translationsettingsdialog.cpp +++ b/src/linguist/linguist/translationsettingsdialog.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2021 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Linguist of the Qt Toolkit. @@ -41,14 +41,16 @@ TranslationSettingsDialog::TranslationSettingsDialog(QWidget *parent) m_ui.setupUi(this); for (int i = QLocale::C + 1; i < QLocale::LastLanguage; ++i) { - QString lang = QLocale::languageToString(QLocale::Language(i)); - auto loc = QLocale(QLocale::Language(i)); - if (loc.language() != QLocale::English) { - QString nln = loc.nativeLanguageName(); - if (!nln.isEmpty()) { - //: () (language and country names) - lang = tr("%1 (%2)").arg(lang, nln); - } + const auto language = QLocale::Language(i); + QString lang = QLocale::languageToString(language); + const auto loc = QLocale(language); + // Languages for which we have no data get mapped to the default locale; + // its endonym is unrelated to the language requested. For English, the + // endonym is the name we already have; don't repeat it. + if (loc.language() == language && language != QLocale::English) { + const QString native = loc.nativeLanguageName(); + if (!native.isEmpty()) //: () (language names) + lang = tr("%1 (%2)").arg(lang, native); } m_ui.srcCbLanguageList->addItem(lang, QVariant(i)); } -- cgit v1.2.3 From c1d799fd51e052425a860847383ad78c1f7645f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20K=C3=B6hne?= Date: Tue, 5 Apr 2022 15:51:08 +0200 Subject: qdoc: Do not generate tags from titles anymore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Qt Creator nowadays searches itself for matches in the title and description, so no point in automatically generating tags from titles anymore. Change-Id: I4aa9912f7bb6dd293b5de8ebff7e751956e6856d Reviewed-by: Eike Ziller Reviewed-by: Topi Reiniƶ (cherry picked from commit f3c96dc9fd0dce00df7ae60f9a1c4ba86eaa2d70) Reviewed-by: Kai Koehne --- src/qdoc/htmlgenerator.cpp | 25 ---------------------- .../expected_output/demos-manifest.xml | 2 +- .../expected_output/examples-manifest.xml | 4 ++-- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index 98039d541..599d33eb3 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -3990,31 +3990,6 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString tags += QSet(tagList.cbegin(), tagList.cend()); } - const auto &titleWords = en->title().toLower().split(QLatin1Char(' ')); - tags += QSet(titleWords.cbegin(), titleWords.cend()); - - // Clean up tags, exclude invalid and common words - QSet::iterator tag_it = tags.begin(); - QSet modified; - while (tag_it != tags.end()) { - QString s = *tag_it; - if (s.at(0) == '(') - s.remove(0, 1).chop(1); - if (s.endsWith(QLatin1Char(':'))) - s.chop(1); - - if (s.length() < 2 || s.at(0).isDigit() || s.at(0) == '-' || s == QLatin1String("qt") - || s == QLatin1String("the") || s == QLatin1String("and") - || s.startsWith(QLatin1String("example")) || s.startsWith(QLatin1String("chapter"))) - tag_it = tags.erase(tag_it); - else if (s != *tag_it) { - modified << s; - tag_it = tags.erase(tag_it); - } else - ++tag_it; - } - tags += modified; - if (!tags.isEmpty()) { writer.writeStartElement("tags"); bool wrote_one = false; diff --git a/tests/auto/qdoc/generatedoutput/expected_output/demos-manifest.xml b/tests/auto/qdoc/generatedoutput/expected_output/demos-manifest.xml index d83906f44..9603ae6ec 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/demos-manifest.xml +++ b/tests/auto/qdoc/generatedoutput/expected_output/demos-manifest.xml @@ -3,7 +3,7 @@ - demo,test + test diff --git a/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml b/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml index 8aa9ce303..8b45dd2a3 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml +++ b/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml @@ -3,12 +3,12 @@ - cmake,project,test + test test/cmaketest/main.cpp - documentation,qml,sample,test + sample,test -- cgit v1.2.3 From d35b8c5a9687ef4b5d76d96c29f14f2c24e5bf2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20K=C3=B6hne?= Date: Wed, 6 Apr 2022 09:17:35 +0200 Subject: qdoc: Do not split module names in different tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This did more harm than good, e.g. for ActiveQt->active,qt QtWebView->web,view. Change-Id: Ia08bc12ef7496fccb1a5d9bbd45c285448417adb Reviewed-by: Topi Reiniƶ (cherry picked from commit 255b9699f6957282200546705ad493ab16631883) Reviewed-by: Kai Koehne --- src/qdoc/htmlgenerator.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index 599d33eb3..a22cae0d3 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -3973,15 +3973,11 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString writer.writeCDATA(QString("No description available")); writer.writeEndElement(); // description - // Add words from module name as tags - // QtQuickControls -> qt,quick,controls - // QtOpenGL -> qt,opengl - QRegExp re("([A-Z]+[a-z0-9]*(3D|GL)?)"); - int pos = 0; - while ((pos = re.indexIn(project, pos)) != -1) { - tags << re.cap(1).toLower(); - pos += re.matchedLength(); - } + // Add module name as tag + QString moduleName = project; + if (moduleName.startsWith("Qt")) + moduleName = moduleName.mid(2); + tags << moduleName.toLower(); // Include tags added via \meta {tag} {tag1[,tag2,...]} // within \example topic -- cgit v1.2.3