From 17b28909a99cce2dc908ad2ffbb43a85539fa526 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 24 Jan 2023 14:39:05 +0100 Subject: [PATCH] QmlJS: Tr::Tr Excluding the Qml parser, which needs to remain in sync with it's copy in Qt. Change-Id: I22f475f265dd74687e3239c4d6916c777798a447 Reviewed-by: hjk --- share/qtcreator/translations/qtcreator_cs.ts | 48 +---- share/qtcreator/translations/qtcreator_da.ts | 33 +--- share/qtcreator/translations/qtcreator_de.ts | 30 +-- share/qtcreator/translations/qtcreator_fr.ts | 46 +---- share/qtcreator/translations/qtcreator_hr.ts | 44 +---- share/qtcreator/translations/qtcreator_ja.ts | 32 +-- share/qtcreator/translations/qtcreator_pl.ts | 30 +-- share/qtcreator/translations/qtcreator_ru.ts | 33 +--- share/qtcreator/translations/qtcreator_sl.ts | 20 +- share/qtcreator/translations/qtcreator_uk.ts | 32 +-- .../qtcreator/translations/qtcreator_zh_CN.ts | 35 +--- .../qtcreator/translations/qtcreator_zh_TW.ts | 11 +- src/libs/qmljs/qmljsbind.cpp | 12 +- src/libs/qmljs/qmljsbind.h | 1 - src/libs/qmljs/qmljscheck.cpp | 11 +- src/libs/qmljs/qmljscheck.h | 2 - src/libs/qmljs/qmljsfindexportedcpptypes.cpp | 12 +- src/libs/qmljs/qmljsfindexportedcpptypes.h | 1 - src/libs/qmljs/qmljsinterpreter.cpp | 11 +- src/libs/qmljs/qmljslink.cpp | 43 ++-- src/libs/qmljs/qmljslink.h | 1 - src/libs/qmljs/qmljsmodelmanagerinterface.cpp | 12 +- src/libs/qmljs/qmljsplugindumper.cpp | 51 ++--- src/libs/qmljs/qmljssimplereader.cpp | 11 +- src/libs/qmljs/qmljssimplereader.h | 7 - src/libs/qmljs/qmljsstaticanalysismessage.cpp | 187 +++++++++--------- src/libs/qmljs/qmljstypedescriptionreader.cpp | 91 ++++----- src/libs/qmljs/qmljstypedescriptionreader.h | 5 - .../designercore/include/metainforeader.h | 1 + 29 files changed, 276 insertions(+), 577 deletions(-) diff --git a/share/qtcreator/translations/qtcreator_cs.ts b/share/qtcreator/translations/qtcreator_cs.ts index ce91986234c..9c83c1edc1e 100644 --- a/share/qtcreator/translations/qtcreator_cs.ts +++ b/share/qtcreator/translations/qtcreator_cs.ts @@ -21332,7 +21332,7 @@ should a repository require SSH-authentication (see documentation on SSH and the - QmlJS::Check + ::QmlJS unknown value for enum Neznámá hodnota pro 'enum' @@ -21529,9 +21529,6 @@ should a repository require SSH-authentication (see documentation on SSH and the 'int' or 'real' 'int' nebo 'real' - - - QmlJS::Interpreter::QmlXmlReader The file is not module file. Soubor není souborem modulu. @@ -21552,21 +21549,10 @@ should a repository require SSH-authentication (see documentation on SSH and the %1: %2 %1: %2 - - - QmlJS::Link could not find file or directory Soubor nebo adresář se nepodařilo najít - - expected two numbers separated by a dot - Byla očekávána dvě čísla oddělená čárkou - - - package import requires a version number - Zavedení balíčku vyžaduje číslo verze - package not found Balíček nenalezen @@ -29056,7 +29042,7 @@ With cache simulation, further event counters are enabled: - QmlJS::Bind + ::QmlJS expected two numbers separated by a dot Byla očekávána dvě čísla oddělená čárkou @@ -29065,13 +29051,6 @@ With cache simulation, further event counters are enabled: package import requires a version number Importování balíčku vyžaduje číslo verze - - file or directory not found - Soubor nebo adresář nenalezen - - - - QmlJS::TypeDescriptionReader Errors while loading qmltypes from %1: %2 @@ -38559,7 +38538,7 @@ Pokud zvolíte nepokračovat, Qt Creator se soubor .shared nahrát nepokusí. - FindExportedCppTypes + ::QmlJS The type will only be available in Qt Creator's QML editors when the type name is a string literal Tento typ bude v editoru QML Qt Creatoru viditelný jen tehdy, když je název typu řetězec znaků tvořený písmeny (literal) @@ -49414,19 +49393,11 @@ nelze najít v cestě. - QmlJS::SimpleAbstractStreamReader + ::QmlJS Cannot find file %1. Nelze najít soubor %1. - - Could not parse document. - Nepodařilo se zpracovat dokument. - - - Expected document to contain a single object definition. - Očekáván dokument obsahující definici jednoho objektu. - Expected expression statement after colon. Po dvojtečce očekáván výraz. @@ -49435,16 +49406,10 @@ nelze najít v cestě. Expected expression statement to be a literal. Očekáván výraz tvořený písmeny (literal). - - - QmlJS::SimpleReader Property is defined twice. Vlastnost je stanovena dvakrát. - - - QmlJS::StaticAnalysisMessages Do not use '%1' as a constructor. '%1' se nesmí používat jako konstruktor. @@ -55517,7 +55482,7 @@ Opravdu chcete pokračovat? - QmlJS::ModelManagerInterface + ::QmlJS Indexing Indexování @@ -55526,9 +55491,6 @@ Opravdu chcete pokračovat? QML import scan Sken importování QML - - - QmlJS::PluginDumper QML module does not contain information about components contained in plugins. diff --git a/share/qtcreator/translations/qtcreator_da.ts b/share/qtcreator/translations/qtcreator_da.ts index 48c164c08ec..0d8e43b0d28 100644 --- a/share/qtcreator/translations/qtcreator_da.ts +++ b/share/qtcreator/translations/qtcreator_da.ts @@ -28715,7 +28715,7 @@ Dette er uafhængigt af visibility-egenskaben i QML. - QmlJS::Bind + ::QmlJS expected two numbers separated by a dot forventede to numre adskilt af et punktum @@ -28724,16 +28724,10 @@ Dette er uafhængigt af visibility-egenskaben i QML. package import requires a version number pakkeimport kræver et versionsnummer - - - QmlJS::Check 'int' or 'real' 'int' eller 'real' - - - QmlJS::Link File or directory not found. Fil eller mappe ikke fundet. @@ -28764,9 +28758,6 @@ Til CMake-projekter, sørg for at QML_IMPORT_PATH-variabler er i CMakeCache.txt. QML module contains C++ plugins, currently reading type information... QML-modul indeholder C++-plugins, læser aktuelt typeinformation... - - - QmlJS::ModelManagerInterface Parsing QML Files Parser QML-filer @@ -28775,9 +28766,6 @@ Til CMake-projekter, sørg for at QML_IMPORT_PATH-variabler er i CMakeCache.txt. Scanning QML Imports Skanner QML importer - - - QmlJS::PluginDumper QML module does not contain information about components contained in plugins. @@ -28867,7 +28855,7 @@ Byg venligst qmldump-programmet på valgmulighedersiden Qt version. - QmlJS::SimpleAbstractStreamReader + ::QmlJS Cannot find file %1. Kan ikke finde filen %1. @@ -28884,16 +28872,10 @@ Byg venligst qmldump-programmet på valgmulighedersiden Qt version.Expected expression statement after colon. Ventede udsagnsudtryk efter kolon. - - - QmlJS::SimpleReader Property is defined twice. Egenskab er defineret to gange. - - - QmlJS::StaticAnalysisMessages Do not use "%1" as a constructor. @@ -29214,9 +29196,6 @@ Se "Checking Code Syntax"-dokumentation for mere information.A State cannot have a child item (%1). En tilstand kan ikke have en barne-post (%1). - - - QmlJS::TypeDescriptionReader Errors while loading qmltypes from %1: %2 @@ -29229,10 +29208,6 @@ Se "Checking Code Syntax"-dokumentation for mere information.Advarsler under indlæsning af qmltypes fra %1: %2 - - Could not parse document. - Kunne ikke parse dokument. - Expected a single import. Forventede en enkelt import. @@ -29245,10 +29220,6 @@ Se "Checking Code Syntax"-dokumentation for mere information.Major version different from 1 not supported. Stor version som ikke er 1 understøttes ikke. - - Expected document to contain a single object definition. - Forventede at dokument indeholder en enkel objekt-definition. - Expected document to contain a Module {} member. Forventede at dokument indeholder et modul {}-medlem. diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index bb5bd51ab3b..cd20bd5fa1a 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -14554,7 +14554,7 @@ Locked components cannot be modified or selected. - QmlJS::Check + ::QmlJS 'int' or 'real' 'int' oder 'real' @@ -14982,7 +14982,7 @@ The name of the build configuration created by default for a generic project. - QmlJS::Link + ::QmlJS File or directory not found. Datei oder Verzeichnis nicht gefunden. @@ -15959,7 +15959,7 @@ Möchten Sie sie überschreiben? - QmlJS::Bind + ::QmlJS Hit maximal recursion depth in AST visit. @@ -16043,7 +16043,7 @@ Möchten Sie sie überschreiben? - QmlJS::TypeDescriptionReader + ::QmlJS Errors while loading qmltypes from %1: %2 @@ -25981,26 +25981,15 @@ wirklich löschen? - QmlJS::SimpleAbstractStreamReader + ::QmlJS Cannot find file %1. Die Datei '%1' kann nicht gefunden werden. - - Could not parse document. - Das Dokument konnte nicht ausgewertet werden. - - - Expected document to contain a single object definition. - Das Dokument sollte eine einzige Objektdefinition enthalten. - Expected expression statement after colon. Nach dem Doppelpunkt wird ein Ausdruck erwartet. - - - QmlJS::SimpleReader Property is defined twice, previous definition at %1:%2 Eigenschaft ist doppelt definiert, vorherige Definition ist bei %1:%2 @@ -26603,7 +26592,7 @@ wirklich löschen? - QmlJS::StaticAnalysisMessages + ::QmlJS Do not use "%1" as a constructor. @@ -30240,7 +30229,7 @@ Um es abzurufen, tippen Sie das Kürzel im Locator, gefolgt von einem Leerzeiche - QmlJS::ModelManagerInterface + ::QmlJS Parsing QML Files Werte QML-Dateien aus @@ -30249,9 +30238,6 @@ Um es abzurufen, tippen Sie das Kürzel im Locator, gefolgt von einem Leerzeiche Scanning QML Imports Durchsuche QML-Imports - - - QmlJS::PluginDumper Automatic type dump of QML module failed. Errors: @@ -50247,7 +50233,7 @@ Teilnamen können verwendet werden, sofern sie eindeutig sind. - QmlJSTools::FindExportedCppTypes + ::QmlJS The type will only be available in the QML editors when the type name is a string literal. Dieser Typ wird im QML Editor nur sichtbar sein, wenn der Typname ein Zeichenketten-Literal ist. diff --git a/share/qtcreator/translations/qtcreator_fr.ts b/share/qtcreator/translations/qtcreator_fr.ts index 9196e36e1a1..40bf257c9e6 100644 --- a/share/qtcreator/translations/qtcreator_fr.ts +++ b/share/qtcreator/translations/qtcreator_fr.ts @@ -20485,7 +20485,7 @@ francis : ouai assez d'accord. - QmlJS::Check + ::QmlJS unknown value for enum Valeur inconnue pour l'énumération @@ -20682,9 +20682,6 @@ francis : ouai assez d'accord. 'int' or 'real' 'int' ou 'real' - - - QmlJS::Interpreter::QmlXmlReader The file is not module file. Le fichier n'est pas un fichier de module. @@ -20705,21 +20702,10 @@ francis : ouai assez d'accord. %1: %2 %1 : %2 - - - QmlJS::Link could not find file or directory impossible de trouver le fichier ou le répertoire - - expected two numbers separated by a dot - est attendu deux nombres séparés par un point - - - package import requires a version number - l'importation d'un paquet a besoin d'un numéro de version - package not found paquet non trouvé @@ -25207,7 +25193,7 @@ Preselects Qt for Simulator and mobile targets if available - QmlJS::Bind + ::QmlJS expected two numbers separated by a dot est attendu deux nombres séparés par un point @@ -25216,10 +25202,6 @@ Preselects Qt for Simulator and mobile targets if available package import requires a version number l'importation d'un paquet a besoin d'un numéro de version - - file or directory not found - Fichier ou répertoire non trouvé - ::ProjectExplorer @@ -28749,11 +28731,7 @@ Les version de Qt précédentes ont des limitations lors de la compilation des f - QmlJS::TypeDescriptionReader - - %1: %2 - %1 : %2 - + ::QmlJS Errors while loading qmltypes from %1: %2 @@ -28782,10 +28760,6 @@ Les version de Qt précédentes ont des limitations lors de la compilation des f Expected version 1.1 or lower. La version 1.1 ou inférieure est attendue. - - Expected document to contain a single object definition. - Un document ne contiennant qu'une seule définition d'objet est attendu. - Expected document to contain a Module {} member. Un document contiennant un membre Modue {} est attendu. @@ -37140,7 +37114,7 @@ Si vous choisissez de ne pas continuer, Qt Creator n'essayera pas de charge - FindExportedCppTypes + ::QmlJS The type will only be available in Qt Creator's QML editors when the type name is a string literal Le type sera disponible dans l'éditeur QML de Qt Creator lorsque le nom du type est une chaîne de caractères @@ -46867,15 +46841,11 @@ Les noms partiels peuvent êtres utilisé s'ils ne sont pas ambigües. - QmlJS::SimpleAbstractStreamReader + ::QmlJS Cannot find file %1. Impossible de trouver le fichier %1. - - Could not parse document. - Impossible d'analyser le document. - Expected document to contain a single object definition. Le document ne devrait contenir qu'une seule définition d'objet. @@ -46888,16 +46858,10 @@ Les noms partiels peuvent êtres utilisé s'ils ne sont pas ambigües.Expected expression statement to be a literal. L'expression doit être littérale. - - - QmlJS::SimpleReader Property is defined twice. Propriété définie deux fois. - - - QmlJS::StaticAnalysisMessages Do not use '%1' as a constructor. Ne pas utiliser '%1' comme un constructeur. diff --git a/share/qtcreator/translations/qtcreator_hr.ts b/share/qtcreator/translations/qtcreator_hr.ts index 00761ad7ac2..7f465f55170 100644 --- a/share/qtcreator/translations/qtcreator_hr.ts +++ b/share/qtcreator/translations/qtcreator_hr.ts @@ -11602,7 +11602,7 @@ will also disable the following plugins: - QmlJS::Bind + ::QmlJS expected two numbers separated by a dot @@ -11611,9 +11611,6 @@ will also disable the following plugins: package import requires a version number - - - QmlJS::Check 'int' or 'real' 'int' ili 'real' @@ -11637,7 +11634,7 @@ the QML editor know about a likely URI. - QmlJS::TypeDescriptionReader + ::QmlJS Errors while loading qmltypes from %1: %2 @@ -11792,9 +11789,6 @@ the QML editor know about a likely URI. Enum should not contain getter and setters, but only 'string: number' elements. - - - QmlJS::Link File or directory not found. @@ -11816,9 +11810,6 @@ For CMake projects, make sure QML_IMPORT_PATH variable is in CMakeCache.txt. QML module contains C++ plugins, currently reading type information... - - - QmlJS::ModelManagerInterface Parsing QML Files @@ -11827,9 +11818,6 @@ For CMake projects, make sure QML_IMPORT_PATH variable is in CMakeCache.txt. Scanning QML Imports - - - QmlJS::PluginDumper QML module does not contain information about components contained in plugins. @@ -11894,46 +11882,18 @@ Error: %2 Please build the qmldump application on the Qt version options page. - - - QmlJS::QrcParser - - XML error on line %1, col %2: %3 - - - - The <RCC> root element is missing. - - - - - QmlJS::SimpleAbstractStreamReader Cannot find file %1. - - Could not parse document. - - - - Expected document to contain a single object definition. - - Expected expression statement after colon. - - - QmlJS::SimpleReader Property is defined twice. - - - QmlJS::StaticAnalysisMessages Do not use "%1" as a constructor. diff --git a/share/qtcreator/translations/qtcreator_ja.ts b/share/qtcreator/translations/qtcreator_ja.ts index 6278a5d23fe..452b27f3bcf 100644 --- a/share/qtcreator/translations/qtcreator_ja.ts +++ b/share/qtcreator/translations/qtcreator_ja.ts @@ -9391,7 +9391,7 @@ will also disable the following plugins: - QmlJS::Bind + ::QmlJS expected two numbers separated by a dot ドットで区切られた2つの数字がありません @@ -9408,16 +9408,10 @@ will also disable the following plugins: Nested inline components are not supported インラインコンポーネントのネストはサポートされていません - - - QmlJS::Check 'int' or 'real' 'int'型か'real'型 - - - QmlJS::TypeDescriptionReader Errors while loading qmltypes from %1: %2 @@ -9590,9 +9584,6 @@ will also disable the following plugins: Enum should not contain getter and setters, but only 'string: number' elements. Enum にはゲッターやセッターは含めずに、'string: number' のみのエレメントを使用してください。 - - - QmlJS::Link File or directory not found. ファイルまたはディレクトリが見つかりません。 @@ -9684,19 +9675,11 @@ CMake プロジェクトでは、CMakeCache.txt 内で QML_IMPORT_PATH 変数を - QmlJS::SimpleAbstractStreamReader + ::QmlJS Cannot find file %1. ファイル %1 が見つかりません。 - - Could not parse document. - ドキュメントを解析できませんでした。 - - - Expected document to contain a single object definition. - ドキュメントは一つのオブジェクト定義を持つ必要があります。 - Expected expression statement after colon. コロンの後には式文が必要です。 @@ -9705,16 +9688,10 @@ CMake プロジェクトでは、CMakeCache.txt 内で QML_IMPORT_PATH 変数を Expected expression statement to be a literal. 式文はリテラルである必要があります。 - - - QmlJS::SimpleReader Property is defined twice. プロパティが二度定義されています。 - - - QmlJS::StaticAnalysisMessages Do not use "%1" as a constructor. @@ -31760,7 +31737,7 @@ To do this, you type this shortcut and a space in the Locator entry field, and t - QmlJS::ModelManagerInterface + ::QmlJS Parsing QML Files QML ファイルの解析中 @@ -31769,9 +31746,6 @@ To do this, you type this shortcut and a space in the Locator entry field, and t Scanning QML Imports QML import のスキャン中 - - - QmlJS::PluginDumper QML module does not contain information about components contained in plugins. diff --git a/share/qtcreator/translations/qtcreator_pl.ts b/share/qtcreator/translations/qtcreator_pl.ts index 02bbe52a176..2ed6dc6c731 100644 --- a/share/qtcreator/translations/qtcreator_pl.ts +++ b/share/qtcreator/translations/qtcreator_pl.ts @@ -10296,14 +10296,11 @@ wyłączy również następujące wtyczki: - QmlJS::Check + ::QmlJS 'int' or 'real' "int" lub "real" - - - QmlJS::Link File or directory not found. Nie można odnaleźć pliku lub katalogu. @@ -12487,7 +12484,7 @@ Identyfikatory muszą rozpoczynać się małą literą. - QmlJS::Bind + ::QmlJS expected two numbers separated by a dot oczekiwano dwóch liczb oddzielonych kropką @@ -13739,7 +13736,7 @@ Local pulls are not applied to the master branch. - QmlJS::TypeDescriptionReader + ::QmlJS Errors while loading qmltypes from %1: %2 @@ -23292,33 +23289,19 @@ Można używać nazw częściowych, jeśli są one unikalne. - QmlJS::SimpleAbstractStreamReader + ::QmlJS Cannot find file %1. Brak pliku %1. - - Could not parse document. - Błąd parsowania dokumentu. - - - Expected document to contain a single object definition. - Oczekiwano dokumentu zawierającego pojedynczą definicję obiektu. - Expected expression statement after colon. Oczekiwano składnika wyrażenia po dwukropku. - - - QmlJS::SimpleReader Property is defined twice. Właściwość jest zdefiniowana dwukrotnie. - - - QmlJS::StaticAnalysisMessages Invalid value for enum. Niepoprawna wartość dla typu wyliczeniowego. @@ -27039,7 +27022,7 @@ Aby uaktywnić ten filtr, wpisz w lokalizatorze powyższy skrót i po spacji pod - QmlJS::ModelManagerInterface + ::QmlJS Parsing QML Files Parsowanie plików QML @@ -27048,9 +27031,6 @@ Aby uaktywnić ten filtr, wpisz w lokalizatorze powyższy skrót i po spacji pod Scanning QML Imports Skanowanie importów QML - - - QmlJS::PluginDumper QML module does not contain information about components contained in plugins. diff --git a/share/qtcreator/translations/qtcreator_ru.ts b/share/qtcreator/translations/qtcreator_ru.ts index 559cf21cf36..c693979b97d 100644 --- a/share/qtcreator/translations/qtcreator_ru.ts +++ b/share/qtcreator/translations/qtcreator_ru.ts @@ -37425,7 +37425,7 @@ This is independent of the visibility property in QML. - QmlJS::Bind + ::QmlJS Hit maximal recursion depth in AST visit Достигнута максимальная глубина рекурсии обработки AST @@ -37434,16 +37434,10 @@ This is independent of the visibility property in QML. package import requires a version number импорт пакета требует номер версии - - - QmlJS::Check 'int' or 'real' «int» или «real» - - - QmlJS::Link File or directory not found. Файл или каталог не найден. @@ -37498,9 +37492,6 @@ For CMake projects, make sure QML_IMPORT_PATH variable is in CMakeCache.txt. QML module contains C++ plugins, currently reading type information... Модуль QML содержит расширения на C++, идёт чтение информации о типах... - - - QmlJS::ModelManagerInterface Parsing QML Files Разбор файлов QML @@ -37509,9 +37500,6 @@ For CMake projects, make sure QML_IMPORT_PATH variable is in CMakeCache.txt. Scanning QML Imports Сканирование импорта QML - - - QmlJS::PluginDumper Automatic type dump of QML module failed. Errors: @@ -37601,7 +37589,7 @@ Please build the qmldump application on the Qt version options page. - QmlJS::SimpleAbstractStreamReader + ::QmlJS Cannot find file %1. Не удалось найти файл %1. @@ -37618,16 +37606,10 @@ Please build the qmldump application on the Qt version options page. Expected expression statement after colon. Ожидается выражение после запятой. - - - QmlJS::SimpleReader Property is defined twice. Свойство определено дважды. - - - QmlJS::StaticAnalysisMessages Do not use "%1" as a constructor. @@ -37960,9 +37942,6 @@ For more information, see the "Checking Code Syntax" documentation.Qt Quick Designer only supports states in the root item. Qt Quick Designer поддерживает состояния только в корневом элементе. - - - QmlJS::TypeDescriptionReader Errors while loading qmltypes from %1: %2 @@ -37975,10 +37954,6 @@ For more information, see the "Checking Code Syntax" documentation.Возникли следующие предупреждения при загрузке информации о типах QML из %1: %2 - - Could not parse document. - Не удалось разобрать документ. - Expected a single import. Ожидается одиночный импорт. @@ -37991,10 +37966,6 @@ For more information, see the "Checking Code Syntax" documentation.Major version different from 1 not supported. Версия с основным номером отличным от 1 не поддерживается. - - Expected document to contain a single object definition. - В документе ожидается определение ровно одного объекта. - Expected document to contain a Module {} member. В документе ожидается наличие члена Module {}. diff --git a/share/qtcreator/translations/qtcreator_sl.ts b/share/qtcreator/translations/qtcreator_sl.ts index e624e54f5eb..2d5b5ff582b 100644 --- a/share/qtcreator/translations/qtcreator_sl.ts +++ b/share/qtcreator/translations/qtcreator_sl.ts @@ -14237,7 +14237,7 @@ okoljsko spremenljivko SSH_ASKPASS. - QmlJS::Check + ::QmlJS unknown value for enum neznana vrednost za oštevilčenje @@ -14406,9 +14406,6 @@ okoljsko spremenljivko SSH_ASKPASS. ids must be lower case ID-ji morajo imeti same male črke - - - QmlJS::Link package not found paket ni bil najden @@ -14421,14 +14418,6 @@ okoljsko spremenljivko SSH_ASKPASS. could not find file or directory datoteke ali mape ni bilo moč najti - - expected two numbers separated by a dot - pričakovani sta bili dve števili ločeni s piko - - - package import requires a version number - uvažanje paketa zahteva številko različice - Utils::FancyMainWindow @@ -20840,7 +20829,7 @@ S simulacijo predpomnilnika so omogočeni dodatni števci dogodkov: - QmlJS::Bind + ::QmlJS expected two numbers separated by a dot pričakovani sta bili dve števili ločeni s piko @@ -20853,9 +20842,6 @@ S simulacijo predpomnilnika so omogočeni dodatni števci dogodkov: file or directory not found datoteke ali mape ni bilo moč najti - - - QmlJS::TypeDescriptionReader Errors while loading qmltypes from %1: %2 @@ -30439,7 +30425,7 @@ Preverite, ali je telefon priključen in ali App TRK teče. - QmlJS::Interpreter::QmlXmlReader + ::QmlJS The file is not module file. Datoteka ni datoteka modula. diff --git a/share/qtcreator/translations/qtcreator_uk.ts b/share/qtcreator/translations/qtcreator_uk.ts index 7d8f5913a89..0785b00344d 100644 --- a/share/qtcreator/translations/qtcreator_uk.ts +++ b/share/qtcreator/translations/qtcreator_uk.ts @@ -14943,7 +14943,7 @@ This is independent of the visibility property in QML. - QmlJS::Bind + ::QmlJS expected two numbers separated by a dot очікувались два числа розділених крапкою @@ -14952,16 +14952,10 @@ This is independent of the visibility property in QML. package import requires a version number імпорт пакунка вимагає номеру версії - - - QmlJS::Check 'int' or 'real' 'int' або 'real' - - - QmlJS::Link file or directory not found файл чи тека не знайдені @@ -15008,9 +15002,6 @@ For qmlproject projects, use the importPaths property to add import paths.QML module contains C++ plugins, currently reading type information... Модуль QML містить додатки C++, триває читання інформації про типи... - - - QmlJS::TypeDescriptionReader Errors while loading qmltypes from %1: %2 @@ -29264,19 +29255,11 @@ cannot be found in the path. - QmlJS::SimpleAbstractStreamReader + ::QmlJS Cannot find file %1. Неможливо знайти файл %1. - - Could not parse document. - Не вдалось розібрати документ. - - - Expected document to contain a single object definition. - - Expected expression statement after colon. @@ -29285,16 +29268,10 @@ cannot be found in the path. Expected expression statement to be a literal. - - - QmlJS::SimpleReader Property is defined twice. Властивість визначено двічі. - - - QmlJS::StaticAnalysisMessages Invalid value for enum. @@ -34750,7 +34727,7 @@ To do this, you type this shortcut and a space in the Locator entry field, and t - QmlJS::ModelManagerInterface + ::QmlJS Indexing Індексування @@ -34767,9 +34744,6 @@ To do this, you type this shortcut and a space in the Locator entry field, and t Scanning QML Imports Сканування імпортів QML - - - QmlJS::PluginDumper QML module does not contain information about components contained in plugins. diff --git a/share/qtcreator/translations/qtcreator_zh_CN.ts b/share/qtcreator/translations/qtcreator_zh_CN.ts index 194da427c95..0a8880ed790 100644 --- a/share/qtcreator/translations/qtcreator_zh_CN.ts +++ b/share/qtcreator/translations/qtcreator_zh_CN.ts @@ -35856,7 +35856,7 @@ Locked components cannot be modified or selected. - QmlJS::Bind + ::QmlJS package import requires a version number 导入包需要版本号 @@ -35869,16 +35869,10 @@ Locked components cannot be modified or selected. Nested inline components are not supported - - - QmlJS::Check 'int' or 'real' '整数' 或 '实数' - - - QmlJS::Link File or directory not found. @@ -35914,9 +35908,6 @@ For CMake projects, make sure QML_IMPORT_PATH variable is in CMakeCache.txt. QML module contains C++ plugins, currently reading type information... %1 - - - QmlJS::ModelManagerInterface Parsing QML Files @@ -35925,9 +35916,6 @@ For CMake projects, make sure QML_IMPORT_PATH variable is in CMakeCache.txt. Scanning QML Imports - - - QmlJS::PluginDumper QML module does not contain information about components contained in plugins. @@ -36009,7 +35997,7 @@ Please build the qmldump application on the Qt version options page. - QmlJS::SimpleAbstractStreamReader + ::QmlJS Cannot find file %1. @@ -36026,16 +36014,10 @@ Please build the qmldump application on the Qt version options page. Expected expression statement after colon. - - - QmlJS::SimpleReader Property is defined twice, previous definition at %1:%2 - - - QmlJS::StaticAnalysisMessages Do not use "%1" as a constructor. @@ -36390,9 +36372,6 @@ For more information, see the "Checking Code Syntax" documentation.Avoid referencing the root item in a hierarchy. - - - QmlJS::TypeDescriptionReader Errors while loading qmltypes from %1: %2 @@ -36405,10 +36384,6 @@ For more information, see the "Checking Code Syntax" documentation.%1导入qmltypes时发生警告: %2 - - Could not parse document. - - Expected a single import. @@ -36421,10 +36396,6 @@ For more information, see the "Checking Code Syntax" documentation.Major version different from 1 not supported. - - Expected document to contain a single object definition. - - Expected document to contain a Module {} member. @@ -36777,7 +36748,7 @@ For more information, see the "Checking Code Syntax" documentation. - QmlJSTools::FindExportedCppTypes + ::QmlJS The type will only be available in the QML editors when the type name is a string literal. diff --git a/share/qtcreator/translations/qtcreator_zh_TW.ts b/share/qtcreator/translations/qtcreator_zh_TW.ts index 6f95fd84449..e0b1abd50ef 100644 --- a/share/qtcreator/translations/qtcreator_zh_TW.ts +++ b/share/qtcreator/translations/qtcreator_zh_TW.ts @@ -12074,14 +12074,11 @@ You can choose between stashing the changes or discarding them. - QmlJS::Check + ::QmlJS 'int' or 'real' 'int' 或 'real' - - - QmlJS::Link file or directory not found 找不到檔案或路徑 @@ -15099,7 +15096,7 @@ Ids must begin with a lowercase letter. - QmlJS::Bind + ::QmlJS expected two numbers separated by a dot 兩個數字應該由點分隔 @@ -17571,7 +17568,7 @@ Local pulls are not applied to the master branch. - QmlJS::TypeDescriptionReader + ::QmlJS Errors while loading qmltypes from %1: %2 @@ -24042,7 +24039,7 @@ If you choose not to continue Qt Creator will not try to load the .shared file.< - FindExportedCppTypes + ::QmlJS The type will only be available in Qt Creator's QML editors when the type name is a string literal 此種類型名稱字串字面常數僅在 Qt Creator 中的 QML編輯器時可使用 diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp index 34424eb7c53..e2143ed68ec 100644 --- a/src/libs/qmljs/qmljsbind.cpp +++ b/src/libs/qmljs/qmljsbind.cpp @@ -2,10 +2,13 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qmljsbind.h" + #include "parser/qmljsast_p.h" -#include "qmljsutils.h" + #include "qmljsdocument.h" #include "qmljsmodelmanagerinterface.h" +#include "qmljstr.h" +#include "qmljsutils.h" #include #include @@ -164,7 +167,8 @@ ObjectValue *Bind::bindObject(UiQualifiedId *qualifiedTypeNameId, UiObjectInitia void Bind::throwRecursionDepthError() { - _diagnosticMessages->append(DiagnosticMessage(Severity::Error, SourceLocation(), tr("Hit maximal recursion depth in AST visit."))); + _diagnosticMessages->append(DiagnosticMessage(Severity::Error, SourceLocation(), + Tr::tr("Hit maximal recursion depth in AST visit."))); } void Bind::accept(Node *node) @@ -212,7 +216,7 @@ bool Bind::visit(UiImport *ast) } if (!version.isValid() && (!qtVersion.isNull() && qtVersion.majorVersion() < 6)) { _diagnosticMessages->append( - errorMessage(ast, tr("package import requires a version number"))); + errorMessage(ast, Tr::tr("package import requires a version number"))); } const QString importId = ast->importId.toString(); @@ -322,7 +326,7 @@ bool Bind::visit(UiInlineComponent *ast) if (!_currentComponentName.isEmpty()) { _currentComponentName += "."; _diagnosticMessages->append( - errorMessage(ast, tr("Nested inline components are not supported"))); + errorMessage(ast, Tr::tr("Nested inline components are not supported"))); } _currentComponentName += ast->name.toString(); _rootObjectValue = nullptr; diff --git a/src/libs/qmljs/qmljsbind.h b/src/libs/qmljs/qmljsbind.h index 1c69d718d28..08a60c17cc1 100644 --- a/src/libs/qmljs/qmljsbind.h +++ b/src/libs/qmljs/qmljsbind.h @@ -17,7 +17,6 @@ class Document; class QMLJS_EXPORT Bind: protected AST::Visitor { Q_DISABLE_COPY(Bind) - Q_DECLARE_TR_FUNCTIONS(QmlJS::Bind) public: Bind(Document *doc, QList *messages, diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index f4afeb4b649..8b6bd8e7dc1 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -2,9 +2,12 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qmljscheck.h" + #include "qmljsbind.h" #include "qmljsevaluate.h" +#include "qmljstr.h" #include "qmljsutils.h" + #include "parser/qmljsast_p.h" #include @@ -1161,7 +1164,7 @@ bool Check::visit(UiPublicMember *ast) const Value *init = evaluator(ast->statement); QString preferredType; if (init->asNumberValue()) - preferredType = tr("'int' or 'real'"); + preferredType = Tr::tr("'int' or 'real'"); else if (init->asStringValue()) preferredType = "'string'"; else if (init->asBooleanValue()) @@ -1216,7 +1219,7 @@ bool Check::visit(IdentifierExpression *) // if (const Reference *ref = value_cast(_lastValue)) { // _lastValue = _context->lookupReference(ref); // if (!_lastValue) -// error(ast->identifierToken, tr("could not resolve")); +// error(ast->identifierToken, Tr::tr("could not resolve")); // } // } // return false; @@ -1233,7 +1236,7 @@ bool Check::visit(FieldMemberExpression *) // const ObjectValue *obj = _lastValue->asObjectValue(); // if (!obj) { // error(locationFromRange(ast->base->firstSourceLocation(), ast->base->lastSourceLocation()), -// tr("does not have members")); +// Tr::tr("does not have members")); // } // if (!obj || ast->name.isEmpty()) { // _lastValue = 0; @@ -1241,7 +1244,7 @@ bool Check::visit(FieldMemberExpression *) // } // _lastValue = obj->lookupMember(ast->name.toString(), _context); // if (!_lastValue) -// error(ast->identifierToken, tr("unknown member")); +// error(ast->identifierToken, Tr::tr("unknown member")); // return false; } diff --git a/src/libs/qmljs/qmljscheck.h b/src/libs/qmljs/qmljscheck.h index 00de4b734d0..a868bbe15e2 100644 --- a/src/libs/qmljs/qmljscheck.h +++ b/src/libs/qmljs/qmljscheck.h @@ -18,8 +18,6 @@ class Imports; class QMLJS_EXPORT Check: protected AST::Visitor { - Q_DECLARE_TR_FUNCTIONS(QmlJS::Check) - typedef QSet StringSet; public: diff --git a/src/libs/qmljs/qmljsfindexportedcpptypes.cpp b/src/libs/qmljs/qmljsfindexportedcpptypes.cpp index d2757a52ff8..7716e77ed5a 100644 --- a/src/libs/qmljs/qmljsfindexportedcpptypes.cpp +++ b/src/libs/qmljs/qmljsfindexportedcpptypes.cpp @@ -3,8 +3,10 @@ #include "qmljsfindexportedcpptypes.h" -#include -#include +#include "qmljsdocument.h" +#include "qmljsinterpreter.h" +#include "qmljstr.h" + #include #include #include @@ -250,7 +252,7 @@ protected: Document::DiagnosticMessage::Warning, _doc->filePath(), line, column, - QmlJS::FindExportedCppTypes::tr( + QmlJS::Tr::tr( "The type will only be available in the QML editors when the type name is a string literal.")); return false; } @@ -311,7 +313,7 @@ protected: Document::DiagnosticMessage::Warning, _doc->filePath(), line, column, - QmlJS::FindExportedCppTypes::tr( + QmlJS::Tr::tr( "The module URI cannot be determined by static analysis. The type will not be available\n" "globally in the QML editor. You can add a \"// @uri My.Module.Uri\" annotation to let\n" "the QML editor know about a likely URI.")); @@ -493,7 +495,7 @@ protected: Document::DiagnosticMessage::Warning, _doc->filePath(), line, column, - QmlJS::FindExportedCppTypes::tr( + QmlJS::Tr::tr( "must be a string literal to be available in the QML editor")); return false; } diff --git a/src/libs/qmljs/qmljsfindexportedcpptypes.h b/src/libs/qmljs/qmljsfindexportedcpptypes.h index 2fdf735ead0..fcab5ba375a 100644 --- a/src/libs/qmljs/qmljsfindexportedcpptypes.h +++ b/src/libs/qmljs/qmljsfindexportedcpptypes.h @@ -14,7 +14,6 @@ namespace QmlJS { class QMLJS_EXPORT FindExportedCppTypes { - Q_DECLARE_TR_FUNCTIONS(QmlJSTools::FindExportedCppTypes) public: FindExportedCppTypes(const CPlusPlus::Snapshot &snapshot); diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 5bcfec37a73..7a2cd6fa717 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -2,14 +2,17 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "parser/qmljsast_p.h" + +#include "qmljsinterpreter.h" + #include "qmljsconstants.h" #include "qmljscontext.h" #include "qmljsevaluate.h" -#include "qmljsinterpreter.h" #include "qmljsmodelmanagerinterface.h" #include "qmljsscopeastpath.h" #include "qmljsscopebuilder.h" #include "qmljsscopechain.h" +#include "qmljstr.h" #include "qmljstypedescriptionreader.h" #include "qmljsvalueowner.h" @@ -1340,13 +1343,11 @@ CppQmlTypesLoader::BuiltinObjects CppQmlTypesLoader::loadQmlTypes(const QFileInf error = file.errorString(); } if (!error.isEmpty()) { - errors->append(TypeDescriptionReader::tr( - "Errors while loading qmltypes from %1:\n%2").arg( + errors->append(Tr::tr("Errors while loading qmltypes from %1:\n%2").arg( qmlTypeFile.absoluteFilePath(), error)); } if (!warning.isEmpty()) { - warnings->append(TypeDescriptionReader::tr( - "Warnings while loading qmltypes from %1:\n%2").arg( + warnings->append(Tr::tr("Warnings while loading qmltypes from %1:\n%2").arg( qmlTypeFile.absoluteFilePath(), warning)); } } diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index 4a690b6e666..5054ce57039 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -4,11 +4,13 @@ #include "qmljslink.h" #include "parser/qmljsast_p.h" -#include "qmljsdocument.h" + #include "qmljsbind.h" -#include "qmljsutils.h" -#include "qmljsmodelmanagerinterface.h" #include "qmljsconstants.h" +#include "qmljsdocument.h" +#include "qmljsmodelmanagerinterface.h" +#include "qmljstr.h" +#include "qmljsutils.h" #include #include @@ -293,7 +295,7 @@ void LinkPrivate::populateImportedTypes(Imports *imports, const Document::Ptr &d imports->setImportFailed(); if (info.ast()) { error(doc, info.ast()->fileNameToken, - Link::tr("File or directory not found.")); + Tr::tr("File or directory not found.")); } break; default: @@ -455,7 +457,7 @@ Import LinkPrivate::importNonFile(const Document::Ptr &doc, const ImportInfo &im error(doc, locationFromRange(importInfo.ast()->firstSourceLocation(), importInfo.ast()->lastSourceLocation()), - Link::tr( + Tr::tr( "QML module not found (%1).\n\n" "Import paths:\n" "%2\n\n" @@ -525,19 +527,19 @@ bool LinkPrivate::importLibrary(const Document::Ptr &doc, if (!(optional || (toImport.flags & QmlDirParser::Import::Optional))) { error(doc, errorLoc, - Link::tr("Implicit import '%1' of QML module '%2' not found.\n\n" - "Import paths:\n" - "%3\n\n" - "For qmake projects, use the QML_IMPORT_PATH variable to add import " - "paths.\n" - "For Qbs projects, declare and set a qmlImportPaths property in " - "your product " - "to add import paths.\n" - "For qmlproject projects, use the importPaths property to add " - "import paths.\n" - "For CMake projects, make sure QML_IMPORT_PATH variable is in " - "CMakeCache.txt.\n") - .arg(importName, + Tr::tr("Implicit import '%1' of QML module '%2' not found.\n\n" + "Import paths:\n" + "%3\n\n" + "For qmake projects, use the QML_IMPORT_PATH variable to add import " + "paths.\n" + "For Qbs projects, declare and set a qmlImportPaths property in " + "your product " + "to add import paths.\n" + "For qmlproject projects, use the importPaths property to add " + "import paths.\n" + "For CMake projects, make sure QML_IMPORT_PATH variable is in " + "CMakeCache.txt.\n") + .arg(importName, importInfo.name(), Utils::transform(m_importPaths, [](const Utils::FilePath &p) { return p.toString(); @@ -569,8 +571,9 @@ bool LinkPrivate::importLibrary(const Document::Ptr &doc, if (!optional && errorLoc.isValid()) { appendDiagnostic(doc, DiagnosticMessage( Severity::ReadingTypeInfoWarning, errorLoc, - Link::tr("QML module contains C++ plugins, " - "currently reading type information... %1").arg(import->info.name()))); + Tr::tr("QML module contains C++ plugins, " + "currently reading type information... %1") + .arg(import->info.name()))); import->valid = false; } } else if (libraryInfo.pluginTypeInfoStatus() == LibraryInfo::DumpError diff --git a/src/libs/qmljs/qmljslink.h b/src/libs/qmljs/qmljslink.h index f1267b24c8b..df061d42b91 100644 --- a/src/libs/qmljs/qmljslink.h +++ b/src/libs/qmljs/qmljslink.h @@ -18,7 +18,6 @@ class LinkPrivate; class QMLJS_EXPORT Link { Q_DISABLE_COPY(Link) - Q_DECLARE_TR_FUNCTIONS(QmlJS::Link) public: Link(Link &&) = delete; diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp index 3f6256684c6..3d2fc32120b 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp @@ -1,15 +1,17 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +#include "qmljsmodelmanagerinterface.h" + #include "qmljsbind.h" #include "qmljsconstants.h" +#include "qmljsdialect.h" #include "qmljsfindexportedcpptypes.h" #include "qmljsinterpreter.h" -#include "qmljsmodelmanagerinterface.h" #include "qmljsplugindumper.h" -#include "qmljsdialect.h" -#include "qmljsviewercontext.h" +#include "qmljstr.h" #include "qmljsutils.h" +#include "qmljsviewercontext.h" #include #include @@ -343,7 +345,7 @@ QFuture ModelManagerInterface::refreshSourceFiles(const QList 1) - addTaskInternal(result, tr("Parsing QML Files"), Constants::TASK_INDEX); + addTaskInternal(result, Tr::tr("Parsing QML Files"), Constants::TASK_INDEX); if (sourceFiles.count() > 1 && !m_shouldScanImports) { bool scan = false; @@ -1209,7 +1211,7 @@ void ModelManagerInterface::maybeScan(const PathsAndLanguages &importPaths) workingCopyInternal(), pathToScan, this, true, true, false); addFuture(result); - addTaskInternal(result, tr("Scanning QML Imports"), Constants::TASK_IMPORT_SCAN); + addTaskInternal(result, Tr::tr("Scanning QML Imports"), Constants::TASK_IMPORT_SCAN); } } diff --git a/src/libs/qmljs/qmljsplugindumper.cpp b/src/libs/qmljs/qmljsplugindumper.cpp index 877f2361140..a7bafdde948 100644 --- a/src/libs/qmljs/qmljsplugindumper.cpp +++ b/src/libs/qmljs/qmljsplugindumper.cpp @@ -2,11 +2,12 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qmljsplugindumper.h" -#include "qmljsmodelmanagerinterface.h" -#include "qmljsutils.h" -#include -#include +#include "qmljsinterpreter.h" +#include "qmljsmodelmanagerinterface.h" +#include "qmljstr.h" +#include "qmljsutils.h" +#include "qmljsviewercontext.h" #include #include @@ -170,16 +171,16 @@ void PluginDumper::dumpAllPlugins() static QString noTypeinfoError(const FilePath &libraryPath) { - return PluginDumper::tr("QML module does not contain information about components contained in plugins.\n\n" - "Module path: %1\n" - "See \"Using QML Modules with Plugins\" in the documentation.").arg( + return Tr::tr("QML module does not contain information about components contained in plugins.\n\n" + "Module path: %1\n" + "See \"Using QML Modules with Plugins\" in the documentation.").arg( libraryPath.toUserOutput()); } static QString qmldumpErrorMessage(const FilePath &libraryPath, const QString &error) { return noTypeinfoError(libraryPath) + "\n\n" + - PluginDumper::tr("Automatic type dump of QML module failed.\nErrors:\n%1"). + Tr::tr("Automatic type dump of QML module failed.\nErrors:\n%1"). arg(error) + QLatin1Char('\n'); } @@ -187,19 +188,19 @@ static QString qmldumpFailedMessage(const FilePath &libraryPath, const QString & { QString firstLines = QStringList(error.split('\n').mid(0, 10)).join('\n'); return noTypeinfoError(libraryPath) + "\n\n" + - PluginDumper::tr("Automatic type dump of QML module failed.\n" - "First 10 lines or errors:\n" - "\n" - "%1" - "\n" - "Check General Messages for details." - ).arg(firstLines); + Tr::tr("Automatic type dump of QML module failed.\n" + "First 10 lines or errors:\n" + "\n" + "%1" + "\n" + "Check General Messages for details." + ).arg(firstLines); } static void printParseWarnings(const FilePath &libraryPath, const QString &warning) { ModelManagerInterface::writeWarning( - PluginDumper::tr("Warnings while parsing QML type information of %1:\n" + Tr::tr("Warnings while parsing QML type information of %1:\n" "%2").arg(libraryPath.toUserOutput(), warning)); } @@ -209,24 +210,24 @@ static QString qmlPluginDumpErrorMessage(QtcProcess *process) const QString binary = process->commandLine().executable().toUserOutput(); switch (process->error()) { case QProcess::FailedToStart: - errorMessage = PluginDumper::tr("\"%1\" failed to start: %2").arg(binary, process->errorString()); + errorMessage = Tr::tr("\"%1\" failed to start: %2").arg(binary, process->errorString()); break; case QProcess::Crashed: - errorMessage = PluginDumper::tr("\"%1\" crashed.").arg(binary); + errorMessage = Tr::tr("\"%1\" crashed.").arg(binary); break; case QProcess::Timedout: - errorMessage = PluginDumper::tr("\"%1\" timed out.").arg(binary); + errorMessage = Tr::tr("\"%1\" timed out.").arg(binary); break; case QProcess::ReadError: case QProcess::WriteError: - errorMessage = PluginDumper::tr("I/O error running \"%1\".").arg(binary); + errorMessage = Tr::tr("I/O error running \"%1\".").arg(binary); break; case QProcess::UnknownError: if (process->exitCode()) - errorMessage = PluginDumper::tr("\"%1\" returned exit code %2.").arg(binary).arg(process->exitCode()); + errorMessage = Tr::tr("\"%1\" returned exit code %2.").arg(binary).arg(process->exitCode()); break; } - errorMessage += '\n' + PluginDumper::tr("Arguments: %1").arg(process->commandLine().arguments()); + errorMessage += '\n' + Tr::tr("Arguments: %1").arg(process->commandLine().arguments()); if (process->error() != QProcess::FailedToStart) { const QString stdErr = QString::fromLocal8Bit(process->readAllRawStandardError()); if (!stdErr.isEmpty()) { @@ -344,7 +345,7 @@ QFuture PluginDumper::loadQmlTypeDescription(c CppQmlTypesLoader::parseQmlTypeDescriptions(reader.data(), &objs, &apis, &deps, &error, &warning, p.toString()); if (!error.isEmpty()) { - result.errors += tr("Failed to parse \"%1\".\nError: %2").arg(p.toUserOutput(), error); + result.errors += Tr::tr("Failed to parse \"%1\".\nError: %2").arg(p.toUserOutput(), error); } else { result.objects += objs.values(); result.moduleApis += apis; @@ -546,7 +547,7 @@ void PluginDumper::prepareLibraryInfo(LibraryInfo &libInfo, libInfo.setPluginTypeInfoStatus(LibraryInfo::TypeInfoFileDone); } else { printParseWarnings(libraryPath, errors.join(QLatin1Char('\n'))); - errs.prepend(tr("Errors while reading typeinfo files:")); + errs.prepend(Tr::tr("Errors while reading typeinfo files:")); libInfo.setPluginTypeInfoStatus(LibraryInfo::TypeInfoFileError, errs.join(QLatin1Char('\n'))); } @@ -635,7 +636,7 @@ void PluginDumper::dump(const Plugin &plugin) errorMessage = noTypeinfoError(plugin.qmldirPath); } else { errorMessage = qmldumpErrorMessage(plugin.qmldirPath, - tr("Could not locate the helper application for dumping type information from C++ plugins.\n" + Tr::tr("Could not locate the helper application for dumping type information from C++ plugins.\n" "Please build the qmldump application on the Qt version options page.")); } diff --git a/src/libs/qmljs/qmljssimplereader.cpp b/src/libs/qmljs/qmljssimplereader.cpp index c5ffd81609e..761131b3a28 100644 --- a/src/libs/qmljs/qmljssimplereader.cpp +++ b/src/libs/qmljs/qmljssimplereader.cpp @@ -13,6 +13,7 @@ #include "qqmljsparser_p.h" #endif +#include "qmljstr.h" #include "qmljsutils.h" #include @@ -110,7 +111,7 @@ static Q_LOGGING_CATEGORY(simpleReaderLog, "qtc.qmljs.simpleReader", QtWarningMs file.close(); return readFromSource(QString::fromLocal8Bit(source)); } - addError(tr("Cannot find file %1.").arg(fileName)); + addError(Tr::tr("Cannot find file %1.").arg(fileName)); return false; } @@ -157,14 +158,14 @@ static Q_LOGGING_CATEGORY(simpleReaderLog, "qtc.qmljs.simpleReader", QtWarningMs bool SimpleAbstractStreamReader::readDocument(AST::UiProgram * ast) { if (!ast) { - addError(tr("Could not parse document.")); + addError(Tr::tr("Could not parse document.")); return false; } AST::UiObjectDefinition *uiObjectDefinition = AST::cast( ast->members->member); if (!uiObjectDefinition) { - addError(tr("Expected document to contain a single object definition.")); + addError(Tr::tr("Expected document to contain a single object definition.")); return false; } readChild(uiObjectDefinition); @@ -237,7 +238,7 @@ static Q_LOGGING_CATEGORY(simpleReaderLog, "qtc.qmljs.simpleReader", QtWarningMs AST::ExpressionStatement *expStmt = AST::cast( uiScriptBinding->statement); if (!expStmt) { - addError(tr("Expected expression statement after colon."), + addError(Tr::tr("Expected expression statement after colon."), uiScriptBinding->statement->firstSourceLocation()); return std::make_pair(QVariant(), SourceLocation()); } @@ -339,7 +340,7 @@ static Q_LOGGING_CATEGORY(simpleReaderLog, "qtc.qmljs.simpleReader", QtWarningMs if (m_currentNode.toStrongRef().data()->propertyNames().contains(name)) { auto previousSourceLoc = m_currentNode.toStrongRef().data()->property(name).nameLocation; - addError(tr("Property is defined twice, previous definition at %1:%2") + addError(Tr::tr("Property is defined twice, previous definition at %1:%2") .arg(QString::number(previousSourceLoc.startLine), QString::number(previousSourceLoc.startColumn)), currentSourceLocation()); diff --git a/src/libs/qmljs/qmljssimplereader.h b/src/libs/qmljs/qmljssimplereader.h index 8c06087fc4b..de57bb62dad 100644 --- a/src/libs/qmljs/qmljssimplereader.h +++ b/src/libs/qmljs/qmljssimplereader.h @@ -18,9 +18,6 @@ #include #include -// for Q_DECLARE_TR_FUNCTIONS -#include - namespace QmlJS { #ifndef QT_CREATOR @@ -84,8 +81,6 @@ using namespace QQmlJS; class QMLJS_EXPORT SimpleAbstractStreamReader { - Q_DECLARE_TR_FUNCTIONS(QmlJS::SimpleAbstractStreamReader) - public: SimpleAbstractStreamReader(); virtual ~SimpleAbstractStreamReader(); @@ -124,8 +119,6 @@ private: class QMLJS_EXPORT SimpleReader: public SimpleAbstractStreamReader { - Q_DECLARE_TR_FUNCTIONS(QmlJS::SimpleReader) - public: SimpleReader(); SimpleReaderNode::Ptr readFile(const QString &fileName); diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.cpp b/src/libs/qmljs/qmljsstaticanalysismessage.cpp index 3bb0d4c94b8..ef24d648c41 100644 --- a/src/libs/qmljs/qmljsstaticanalysismessage.cpp +++ b/src/libs/qmljs/qmljsstaticanalysismessage.cpp @@ -2,7 +2,10 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qmljsstaticanalysismessage.h" + #include "qmljsconstants.h" +#include "qmljstr.h" + #include "parser/qmljsengine_p.h" #include "parser/qmljsdiagnosticmessage_p.h" @@ -19,8 +22,6 @@ namespace { class StaticAnalysisMessages { - Q_DECLARE_TR_FUNCTIONS(QmlJS::StaticAnalysisMessages) - public: void newMsg(Type type, Enum severity, const QString &message, int placeholders = 0) { @@ -40,9 +41,9 @@ public: static inline QString msgInvalidConstructor(const char *what) { - return StaticAnalysisMessages::tr("Do not use \"%1\" as a constructor." - "\n\nFor more information, see the" - " \"Checking Code Syntax\" documentation.") + return Tr::tr("Do not use \"%1\" as a constructor." + "\n\nFor more information, see the" + " \"Checking Code Syntax\" documentation.") .arg(QLatin1String(what)); } @@ -51,63 +52,63 @@ StaticAnalysisMessages::StaticAnalysisMessages() // When changing a message or severity, update the documentation, currently // in creator-code-syntax.qdoc, accordingly. newMsg(ErrInvalidEnumValue, Error, - tr("Invalid value for enum.")); + Tr::tr("Invalid value for enum.")); newMsg(ErrEnumValueMustBeStringOrNumber, Error, - tr("Enum value must be a string or a number.")); + Tr::tr("Enum value must be a string or a number.")); newMsg(ErrNumberValueExpected, Error, - tr("Number value expected.")); + Tr::tr("Number value expected.")); newMsg(ErrBooleanValueExpected, Error, - tr("Boolean value expected.")); + Tr::tr("Boolean value expected.")); newMsg(ErrStringValueExpected, Error, - tr("String value expected.")); + Tr::tr("String value expected.")); newMsg(ErrInvalidUrl, Error, - tr("Invalid URL.")); + Tr::tr("Invalid URL.")); newMsg(WarnFileOrDirectoryDoesNotExist, Warning, - tr("File or directory does not exist.")); + Tr::tr("File or directory does not exist.")); newMsg(ErrInvalidColor, Error, - tr("Invalid color.")); + Tr::tr("Invalid color.")); newMsg(ErrAnchorLineExpected, Error, - tr("Anchor line expected.")); + Tr::tr("Anchor line expected.")); newMsg(ErrPropertiesCanOnlyHaveOneBinding, Error, - tr("Duplicate property binding.")); + Tr::tr("Duplicate property binding.")); newMsg(ErrIdExpected, Error, - tr("Id expected.")); + Tr::tr("Id expected.")); newMsg(ErrInvalidId, Error, - tr("Invalid id.")); + Tr::tr("Invalid id.")); newMsg(ErrDuplicateId, Error, - tr("Duplicate id.")); + Tr::tr("Duplicate id.")); newMsg(ErrInvalidPropertyName, Error, - tr("Invalid property name \"%1\"."), 1); + Tr::tr("Invalid property name \"%1\"."), 1); newMsg(ErrDoesNotHaveMembers, Error, - tr("\"%1\" does not have members."), 1); + Tr::tr("\"%1\" does not have members."), 1); newMsg(ErrInvalidMember, Error, - tr("\"%1\" is not a member of \"%2\"."), 2); + Tr::tr("\"%1\" is not a member of \"%2\"."), 2); newMsg(WarnAssignmentInCondition, Warning, - tr("Assignment in condition.")); + Tr::tr("Assignment in condition.")); newMsg(WarnCaseWithoutFlowControl, Warning, - tr("Unterminated non-empty case block.")); + Tr::tr("Unterminated non-empty case block.")); newMsg(WarnEval, Warning, - tr("Do not use 'eval'.")); + Tr::tr("Do not use 'eval'.")); newMsg(WarnUnreachable, Warning, - tr("Unreachable.")); + Tr::tr("Unreachable.")); newMsg(WarnWith, Warning, - tr("Do not use 'with'.")); + Tr::tr("Do not use 'with'.")); newMsg(WarnComma, Warning, - tr("Do not use comma expressions.")); + Tr::tr("Do not use comma expressions.")); newMsg(WarnAlreadyFormalParameter, Warning, - tr("\"%1\" already is a formal parameter."), 1); + Tr::tr("\"%1\" already is a formal parameter."), 1); newMsg(WarnUnnecessaryMessageSuppression, Warning, - tr("Unnecessary message suppression.")); + Tr::tr("Unnecessary message suppression.")); newMsg(WarnAlreadyFunction, Warning, - tr("\"%1\" already is a function."), 1); + Tr::tr("\"%1\" already is a function."), 1); newMsg(WarnVarUsedBeforeDeclaration, Warning, - tr("var \"%1\" is used before its declaration."), 1); + Tr::tr("var \"%1\" is used before its declaration."), 1); newMsg(WarnAlreadyVar, Warning, - tr("\"%1\" already is a var."), 1); + Tr::tr("\"%1\" already is a var."), 1); newMsg(WarnDuplicateDeclaration, Warning, - tr("\"%1\" is declared more than once."), 1); + Tr::tr("\"%1\" is declared more than once."), 1); newMsg(WarnFunctionUsedBeforeDeclaration, Warning, - tr("Function \"%1\" is used before its declaration."), 1); + Tr::tr("Function \"%1\" is used before its declaration."), 1); newMsg(WarnBooleanConstructor, Warning, msgInvalidConstructor("Boolean")); newMsg(WarnStringConstructor, Warning, @@ -119,124 +120,124 @@ StaticAnalysisMessages::StaticAnalysisMessages() newMsg(WarnFunctionConstructor, Warning, msgInvalidConstructor("Function")); newMsg(HintAnonymousFunctionSpacing, Hint, - tr("The 'function' keyword and the opening parenthesis should be separated by a single space.")); + Tr::tr("The 'function' keyword and the opening parenthesis should be separated by a single space.")); newMsg(WarnBlock, Warning, - tr("Do not use stand-alone blocks.")); + Tr::tr("Do not use stand-alone blocks.")); newMsg(WarnVoid, Warning, - tr("Do not use void expressions.")); + Tr::tr("Do not use void expressions.")); newMsg(WarnConfusingPluses, Warning, - tr("Confusing pluses.")); + Tr::tr("Confusing pluses.")); newMsg(WarnConfusingMinuses, Warning, - tr("Confusing minuses.")); + Tr::tr("Confusing minuses.")); newMsg(HintDeclareVarsInOneLine, Hint, - tr("Declare all function vars on a single line.")); + Tr::tr("Declare all function vars on a single line.")); newMsg(HintExtraParentheses, Hint, - tr("Unnecessary parentheses.")); + Tr::tr("Unnecessary parentheses.")); newMsg(MaybeWarnEqualityTypeCoercion, MaybeWarning, - tr("== and != may perform type coercion, use === or !== to avoid it.")); + Tr::tr("== and != may perform type coercion, use === or !== to avoid it.")); newMsg(WarnConfusingExpressionStatement, Warning, - tr("Expression statements should be assignments, calls or delete expressions only.")); + Tr::tr("Expression statements should be assignments, calls or delete expressions only.")); newMsg(HintDeclarationsShouldBeAtStartOfFunction, Hint, - tr("Place var declarations at the start of a function.")); + Tr::tr("Place var declarations at the start of a function.")); newMsg(HintOneStatementPerLine, Hint, - tr("Use only one statement per line.")); + Tr::tr("Use only one statement per line.")); newMsg(ErrUnknownComponent, Error, - tr("Unknown component.")); + Tr::tr("Unknown component.")); newMsg(ErrCouldNotResolvePrototypeOf, Error, - tr("Could not resolve the prototype \"%1\" of \"%2\"."), 2); + Tr::tr("Could not resolve the prototype \"%1\" of \"%2\"."), 2); newMsg(ErrCouldNotResolvePrototype, Error, - tr("Could not resolve the prototype \"%1\"."), 1); + Tr::tr("Could not resolve the prototype \"%1\"."), 1); newMsg(ErrPrototypeCycle, Error, - tr("Prototype cycle, the last non-repeated component is \"%1\"."), 1); + Tr::tr("Prototype cycle, the last non-repeated component is \"%1\"."), 1); newMsg(ErrInvalidPropertyType, Error, - tr("Invalid property type \"%1\"."), 1); + Tr::tr("Invalid property type \"%1\"."), 1); newMsg(WarnEqualityTypeCoercion, Error, - tr("== and != perform type coercion, use === or !== to avoid it.")); + Tr::tr("== and != perform type coercion, use === or !== to avoid it.")); newMsg(WarnExpectedNewWithUppercaseFunction, Error, - tr("Calls of functions that start with an uppercase letter should use 'new'.")); + Tr::tr("Calls of functions that start with an uppercase letter should use 'new'.")); newMsg(WarnNewWithLowercaseFunction, Error, - tr("Use 'new' only with functions that start with an uppercase letter.")); + Tr::tr("Use 'new' only with functions that start with an uppercase letter.")); newMsg(WarnNumberConstructor, Error, msgInvalidConstructor("Function")); newMsg(HintBinaryOperatorSpacing, Hint, - tr("Use spaces around binary operators.")); + Tr::tr("Use spaces around binary operators.")); newMsg(WarnUnintentinalEmptyBlock, Error, - tr("Unintentional empty block, use ({}) for empty object literal.")); + Tr::tr("Unintentional empty block, use ({}) for empty object literal.")); newMsg(HintPreferNonVarPropertyType, Hint, - tr("Use %1 instead of 'var' or 'variant' to improve performance."), 1); + Tr::tr("Use %1 instead of 'var' or 'variant' to improve performance."), 1); newMsg(ErrMissingRequiredProperty, Error, - tr("Missing property \"%1\"."), 1); + Tr::tr("Missing property \"%1\"."), 1); newMsg(ErrObjectValueExpected, Error, - tr("Object value expected.")); + Tr::tr("Object value expected.")); newMsg(ErrArrayValueExpected, Error, - tr("Array value expected.")); + Tr::tr("Array value expected.")); newMsg(ErrDifferentValueExpected, Error, - tr("%1 value expected."), 1); + Tr::tr("%1 value expected."), 1); newMsg(ErrSmallerNumberValueExpected, Error, - tr("Maximum number value is %1."), 1); + Tr::tr("Maximum number value is %1."), 1); newMsg(ErrLargerNumberValueExpected, Error, - tr("Minimum number value is %1."), 1); + Tr::tr("Minimum number value is %1."), 1); newMsg(ErrMaximumNumberValueIsExclusive, Error, - tr("Maximum number value is exclusive.")); + Tr::tr("Maximum number value is exclusive.")); newMsg(ErrMinimumNumberValueIsExclusive, Error, - tr("Minimum number value is exclusive.")); + Tr::tr("Minimum number value is exclusive.")); newMsg(ErrInvalidStringValuePattern, Error, - tr("String value does not match required pattern.")); + Tr::tr("String value does not match required pattern.")); newMsg(ErrLongerStringValueExpected, Error, - tr("Minimum string value length is %1."), 1); + Tr::tr("Minimum string value length is %1."), 1); newMsg(ErrShorterStringValueExpected, Error, - tr("Maximum string value length is %1."), 1); + Tr::tr("Maximum string value length is %1."), 1); newMsg(ErrInvalidArrayValueLength, Error, - tr("%1 elements expected in array value."), 1); + Tr::tr("%1 elements expected in array value."), 1); newMsg(WarnImperativeCodeNotEditableInVisualDesigner, Warning, - tr("Imperative code is not supported in Qt Design Studio.")); + Tr::tr("Imperative code is not supported in Qt Design Studio.")); newMsg(WarnUnsupportedTypeInVisualDesigner, Warning, - tr("This type (%1) is not supported in Qt Design Studio."), 1); + Tr::tr("This type (%1) is not supported in Qt Design Studio."), 1); newMsg(WarnReferenceToParentItemNotSupportedByVisualDesigner, Warning, - tr("Reference to parent item cannot be resolved correctly by Qt Design Studio.")); + Tr::tr("Reference to parent item cannot be resolved correctly by Qt Design Studio.")); newMsg(WarnUndefinedValueForVisualDesigner, Warning, - tr("This visual property binding cannot be evaluated in the local context " - "and might not show up in Qt Design Studio as expected.")); + Tr::tr("This visual property binding cannot be evaluated in the local context " + "and might not show up in Qt Design Studio as expected.")); newMsg(WarnStatesOnlyInRootItemForVisualDesigner, Warning, - tr("Qt Design Studio only supports states in the root item.")); + Tr::tr("Qt Design Studio only supports states in the root item.")); newMsg(ErrInvalidIdeInVisualDesigner, Error, - tr("This id might be ambiguous and is not supported in Qt Design Studio.")); + Tr::tr("This id might be ambiguous and is not supported in Qt Design Studio.")); newMsg(ErrUnsupportedRootTypeInVisualDesigner, Error, - tr("This type (%1) is not supported as a root element by Qt Design Studio."), 1); + Tr::tr("This type (%1) is not supported as a root element by Qt Design Studio."), 1); newMsg(ErrUnsupportedRootTypeInQmlUi, Error, - tr("This type (%1) is not supported as a root element of a UI file (.ui.qml)."), 1); + Tr::tr("This type (%1) is not supported as a root element of a UI file (.ui.qml)."), 1); newMsg(ErrUnsupportedTypeInQmlUi, Error, - tr("This type (%1) is not supported in a UI file (.ui.qml)."), 1); + Tr::tr("This type (%1) is not supported in a UI file (.ui.qml)."), 1); newMsg(ErrFunctionsNotSupportedInQmlUi, Error, - tr("Functions are not supported in a UI file (.ui.qml).")); + Tr::tr("Functions are not supported in a UI file (.ui.qml).")); newMsg(ErrBlocksNotSupportedInQmlUi, Error, - tr("JavaScript blocks are not supported in a UI file (.ui.qml).")); + Tr::tr("JavaScript blocks are not supported in a UI file (.ui.qml).")); newMsg(ErrBehavioursNotSupportedInQmlUi, Error, - tr("Behavior type is not supported in a UI file (.ui.qml).")); + Tr::tr("Behavior type is not supported in a UI file (.ui.qml).")); newMsg(ErrStatesOnlyInRootItemInQmlUi, Error, - tr("States are only supported in the root item in a UI file (.ui.qml).")); + Tr::tr("States are only supported in the root item in a UI file (.ui.qml).")); newMsg(ErrReferenceToParentItemNotSupportedInQmlUi, Error, - tr("Referencing the parent of the root item is not supported in a UI file (.ui.qml).")); + Tr::tr("Referencing the parent of the root item is not supported in a UI file (.ui.qml).")); newMsg(ErrDoNotMixTranslationFunctionsInQmlUi, Error, - tr("Do not mix translation functions in a UI file (.ui.qml).")); + Tr::tr("Do not mix translation functions in a UI file (.ui.qml).")); newMsg(StateCannotHaveChildItem, Error, - tr("A State cannot have a child item (%1)."), 1); + Tr::tr("A State cannot have a child item (%1)."), 1); newMsg(WarnDuplicateImport, Warning, - tr("Duplicate import (%1)."), 1); + Tr::tr("Duplicate import (%1)."), 1); newMsg(ErrHitMaximumRecursion, Error, - tr("Hit maximum recursion limit when visiting AST.")); + Tr::tr("Hit maximum recursion limit when visiting AST.")); newMsg(ErrTypeIsInstantiatedRecursively, Error, - tr("Type cannot be instantiated recursively (%1)."), 1); + Tr::tr("Type cannot be instantiated recursively (%1)."), 1); newMsg(WarnLogicalValueDoesNotDependOnValues, Warning, - tr("Logical value does not depend on actual values.")); + Tr::tr("Logical value does not depend on actual values.")); newMsg(ErrToManyComponentChildren, Error, - tr("Components are only allowed to have a single child element.")); + Tr::tr("Components are only allowed to have a single child element.")); newMsg(WarnComponentRequiresChildren, Warning, - tr("Components require a child element.")); + Tr::tr("Components require a child element.")); newMsg(ErrAliasReferRoot, Error, - tr("Do not reference the root item as alias.")); + Tr::tr("Do not reference the root item as alias.")); newMsg(WarnAliasReferRootHierarchy, Warning, - tr("Avoid referencing the root item in a hierarchy.")); + Tr::tr("Avoid referencing the root item in a hierarchy.")); } } // anonymous namespace diff --git a/src/libs/qmljs/qmljstypedescriptionreader.cpp b/src/libs/qmljs/qmljstypedescriptionreader.cpp index d01a1f704e8..d8d19eefa3c 100644 --- a/src/libs/qmljs/qmljstypedescriptionreader.cpp +++ b/src/libs/qmljs/qmljstypedescriptionreader.cpp @@ -9,6 +9,7 @@ #include "parser/qmljsengine_p.h" #include "qmljsinterpreter.h" +#include "qmljstr.h" #include "qmljsutils.h" #include @@ -69,18 +70,18 @@ QString TypeDescriptionReader::warningMessage() const void TypeDescriptionReader::readDocument(UiProgram *ast) { if (!ast) { - addError(SourceLocation(), tr("Could not parse document.")); + addError(SourceLocation(), Tr::tr("Could not parse document.")); return; } if (!ast->headers || ast->headers->next || !AST::cast(ast->headers->headerItem)) { - addError(SourceLocation(), tr("Expected a single import.")); + addError(SourceLocation(), Tr::tr("Expected a single import.")); return; } UiImport *import = AST::cast(ast->headers->headerItem); if (toString(import->importUri) != QLatin1String("QtQuick.tooling")) { - addError(import->importToken, tr("Expected import of QtQuick.tooling.")); + addError(import->importToken, Tr::tr("Expected import of QtQuick.tooling.")); return; } @@ -88,24 +89,24 @@ void TypeDescriptionReader::readDocument(UiProgram *ast) if (UiVersionSpecifier *uiVersion = import->version) { version = ComponentVersion(import->version->majorVersion, import->version->minorVersion); if (version.majorVersion() != 1) { - addError(uiVersion->majorToken, tr("Major version different from 1 not supported.")); + addError(uiVersion->majorToken, Tr::tr("Major version different from 1 not supported.")); return; } } if (!ast->members || !ast->members->member || ast->members->next) { - addError(SourceLocation(), tr("Expected document to contain a single object definition.")); + addError(SourceLocation(), Tr::tr("Expected document to contain a single object definition.")); return; } UiObjectDefinition *module = AST::cast(ast->members->member); if (!module) { - addError(SourceLocation(), tr("Expected document to contain a single object definition.")); + addError(SourceLocation(), Tr::tr("Expected document to contain a single object definition.")); return; } if (toString(module->qualifiedTypeNameId) != QLatin1String("Module")) { - addError(SourceLocation(), tr("Expected document to contain a Module {} member.")); + addError(SourceLocation(), Tr::tr("Expected document to contain a Module {} member.")); return; } @@ -161,12 +162,12 @@ void TypeDescriptionReader::readDependencies(UiScriptBinding *ast) { ExpressionStatement *stmt = AST::cast(ast->statement); if (!stmt) { - addError(ast->statement->firstSourceLocation(), tr("Expected dependency definitions")); + addError(ast->statement->firstSourceLocation(), Tr::tr("Expected dependency definitions")); return; } ArrayPattern *exp = AST::cast(stmt->expression); if (!exp) { - addError(stmt->expression->firstSourceLocation(), tr("Expected dependency definitions")); + addError(stmt->expression->firstSourceLocation(), Tr::tr("Expected dependency definitions")); return; } for (PatternElementList *l = exp->elements; l; l = l->next) { @@ -219,7 +220,7 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast) } if (fmo->className().isEmpty()) { - addError(ast->firstSourceLocation(), tr("Component definition is missing a name binding.")); + addError(ast->firstSourceLocation(), Tr::tr("Component definition is missing a name binding.")); return; } @@ -250,7 +251,7 @@ void TypeDescriptionReader::readModuleApi(UiObjectDefinition *ast) } if (!apiInfo.version.isValid()) { - addError(ast->firstSourceLocation(), tr("ModuleApi definition has no or invalid version binding.")); + addError(ast->firstSourceLocation(), Tr::tr("ModuleApi definition has no or invalid version binding.")); return; } @@ -287,7 +288,7 @@ void TypeDescriptionReader::readSignalOrMethod(UiObjectDefinition *ast, bool isM } if (fmm.methodName().isEmpty()) { - addError(ast->firstSourceLocation(), tr("Method or signal is missing a name script binding.")); + addError(ast->firstSourceLocation(), Tr::tr("Method or signal is missing a name script binding.")); return; } @@ -307,7 +308,7 @@ void TypeDescriptionReader::readProperty(UiObjectDefinition *ast, FakeMetaObject UiObjectMember *member = it->member; UiScriptBinding *script = AST::cast(member); if (!script) { - addWarning(member->firstSourceLocation(), tr("Expected script binding.")); + addWarning(member->firstSourceLocation(), Tr::tr("Expected script binding.")); continue; } @@ -327,7 +328,7 @@ void TypeDescriptionReader::readProperty(UiObjectDefinition *ast, FakeMetaObject } if (name.isEmpty() || type.isEmpty()) { - addError(ast->firstSourceLocation(), tr("Property object is missing a name or type script binding.")); + addError(ast->firstSourceLocation(), Tr::tr("Property object is missing a name or type script binding.")); return; } @@ -342,7 +343,7 @@ void TypeDescriptionReader::readEnum(UiObjectDefinition *ast, FakeMetaObject::Pt UiObjectMember *member = it->member; UiScriptBinding *script = AST::cast(member); if (!script) { - addWarning(member->firstSourceLocation(), tr("Expected script binding.")); + addWarning(member->firstSourceLocation(), Tr::tr("Expected script binding.")); continue; } @@ -365,7 +366,7 @@ void TypeDescriptionReader::readParameter(UiObjectDefinition *ast, FakeMetaMetho UiObjectMember *member = it->member; UiScriptBinding *script = AST::cast(member); if (!script) { - addWarning(member->firstSourceLocation(), tr("Expected script binding.")); + addWarning(member->firstSourceLocation(), Tr::tr("Expected script binding.")); continue; } @@ -391,19 +392,19 @@ QString TypeDescriptionReader::readStringBinding(UiScriptBinding *ast) QTC_ASSERT(ast, return QString()); if (!ast->statement) { - addError(ast->colonToken, tr("Expected string after colon.")); + addError(ast->colonToken, Tr::tr("Expected string after colon.")); return QString(); } ExpressionStatement *expStmt = AST::cast(ast->statement); if (!expStmt) { - addError(ast->statement->firstSourceLocation(), tr("Expected string after colon.")); + addError(ast->statement->firstSourceLocation(), Tr::tr("Expected string after colon.")); return QString(); } StringLiteral *stringLit = AST::cast(expStmt->expression); if (!stringLit) { - addError(expStmt->firstSourceLocation(), tr("Expected string after colon.")); + addError(expStmt->firstSourceLocation(), Tr::tr("Expected string after colon.")); return QString(); } @@ -415,20 +416,20 @@ bool TypeDescriptionReader::readBoolBinding(AST::UiScriptBinding *ast) QTC_ASSERT(ast, return false); if (!ast->statement) { - addError(ast->colonToken, tr("Expected boolean after colon.")); + addError(ast->colonToken, Tr::tr("Expected boolean after colon.")); return false; } ExpressionStatement *expStmt = AST::cast(ast->statement); if (!expStmt) { - addError(ast->statement->firstSourceLocation(), tr("Expected boolean after colon.")); + addError(ast->statement->firstSourceLocation(), Tr::tr("Expected boolean after colon.")); return false; } TrueLiteral *trueLit = AST::cast(expStmt->expression); FalseLiteral *falseLit = AST::cast(expStmt->expression); if (!trueLit && !falseLit) { - addError(expStmt->firstSourceLocation(), tr("Expected true or false after colon.")); + addError(expStmt->firstSourceLocation(), Tr::tr("Expected true or false after colon.")); return false; } @@ -440,19 +441,19 @@ double TypeDescriptionReader::readNumericBinding(AST::UiScriptBinding *ast) QTC_ASSERT(ast, return qQNaN()); if (!ast->statement) { - addError(ast->colonToken, tr("Expected numeric literal after colon.")); + addError(ast->colonToken, Tr::tr("Expected numeric literal after colon.")); return 0; } ExpressionStatement *expStmt = AST::cast(ast->statement); if (!expStmt) { - addError(ast->statement->firstSourceLocation(), tr("Expected numeric literal after colon.")); + addError(ast->statement->firstSourceLocation(), Tr::tr("Expected numeric literal after colon.")); return 0; } NumericLiteral *numericLit = AST::cast(expStmt->expression); if (!numericLit) { - addError(expStmt->firstSourceLocation(), tr("Expected numeric literal after colon.")); + addError(expStmt->firstSourceLocation(), Tr::tr("Expected numeric literal after colon.")); return 0; } @@ -464,19 +465,19 @@ ComponentVersion TypeDescriptionReader::readNumericVersionBinding(UiScriptBindin ComponentVersion invalidVersion; if (!ast || !ast->statement) { - addError((ast ? ast->colonToken : SourceLocation()), tr("Expected numeric literal after colon.")); + addError((ast ? ast->colonToken : SourceLocation()), Tr::tr("Expected numeric literal after colon.")); return invalidVersion; } ExpressionStatement *expStmt = AST::cast(ast->statement); if (!expStmt) { - addError(ast->statement->firstSourceLocation(), tr("Expected numeric literal after colon.")); + addError(ast->statement->firstSourceLocation(), Tr::tr("Expected numeric literal after colon.")); return invalidVersion; } NumericLiteral *numericLit = AST::cast(expStmt->expression); if (!numericLit) { - addError(expStmt->firstSourceLocation(), tr("Expected numeric literal after colon.")); + addError(expStmt->firstSourceLocation(), Tr::tr("Expected numeric literal after colon.")); return invalidVersion; } @@ -489,7 +490,7 @@ int TypeDescriptionReader::readIntBinding(AST::UiScriptBinding *ast) int i = static_cast(v); if (i != v) { - addError(ast->firstSourceLocation(), tr("Expected integer after colon.")); + addError(ast->firstSourceLocation(), Tr::tr("Expected integer after colon.")); return 0; } @@ -501,26 +502,26 @@ void TypeDescriptionReader::readExports(UiScriptBinding *ast, FakeMetaObject::Pt QTC_ASSERT(ast, return); if (!ast->statement) { - addError(ast->colonToken, tr("Expected array of strings after colon.")); + addError(ast->colonToken, Tr::tr("Expected array of strings after colon.")); return; } ExpressionStatement *expStmt = AST::cast(ast->statement); if (!expStmt) { - addError(ast->statement->firstSourceLocation(), tr("Expected array of strings after colon.")); + addError(ast->statement->firstSourceLocation(), Tr::tr("Expected array of strings after colon.")); return; } ArrayPattern *arrayLit = AST::cast(expStmt->expression); if (!arrayLit) { - addError(expStmt->firstSourceLocation(), tr("Expected array of strings after colon.")); + addError(expStmt->firstSourceLocation(), Tr::tr("Expected array of strings after colon.")); return; } for (PatternElementList *it = arrayLit->elements; it; it = it->next) { StringLiteral *stringLit = AST::cast(it->element->initializer); if (!stringLit) { - addError(arrayLit->firstSourceLocation(), tr("Expected array literal with only string literal members.")); + addError(arrayLit->firstSourceLocation(), Tr::tr("Expected array literal with only string literal members.")); return; } QString exp = stringLit->value.toString(); @@ -529,7 +530,7 @@ void TypeDescriptionReader::readExports(UiScriptBinding *ast, FakeMetaObject::Pt ComponentVersion version(exp.mid(spaceIdx + 1)); if (spaceIdx == -1 || !version.isValid()) { - addError(stringLit->firstSourceLocation(), tr("Expected string literal to contain 'Package/Name major.minor' or 'Name major.minor'.")); + addError(stringLit->firstSourceLocation(), Tr::tr("Expected string literal to contain 'Package/Name major.minor' or 'Name major.minor'.")); continue; } QString package; @@ -547,19 +548,19 @@ void TypeDescriptionReader::readMetaObjectRevisions(UiScriptBinding *ast, FakeMe QTC_ASSERT(ast, return); if (!ast->statement) { - addError(ast->colonToken, tr("Expected array of numbers after colon.")); + addError(ast->colonToken, Tr::tr("Expected array of numbers after colon.")); return; } ExpressionStatement *expStmt = AST::cast(ast->statement); if (!expStmt) { - addError(ast->statement->firstSourceLocation(), tr("Expected array of numbers after colon.")); + addError(ast->statement->firstSourceLocation(), Tr::tr("Expected array of numbers after colon.")); return; } ArrayPattern *arrayLit = AST::cast(expStmt->expression); if (!arrayLit) { - addError(expStmt->firstSourceLocation(), tr("Expected array of numbers after colon.")); + addError(expStmt->firstSourceLocation(), Tr::tr("Expected array of numbers after colon.")); return; } @@ -568,19 +569,19 @@ void TypeDescriptionReader::readMetaObjectRevisions(UiScriptBinding *ast, FakeMe for (PatternElementList *it = arrayLit->elements; it; it = it->next, ++exportIndex) { NumericLiteral *numberLit = cast(it->element->initializer); if (!numberLit) { - addError(arrayLit->firstSourceLocation(), tr("Expected array literal with only number literal members.")); + addError(arrayLit->firstSourceLocation(), Tr::tr("Expected array literal with only number literal members.")); return; } if (exportIndex >= exportCount) { - addError(numberLit->firstSourceLocation(), tr("Meta object revision without matching export.")); + addError(numberLit->firstSourceLocation(), Tr::tr("Meta object revision without matching export.")); return; } const double v = numberLit->value; const int metaObjectRevision = static_cast(v); if (metaObjectRevision != v) { - addError(numberLit->firstSourceLocation(), tr("Expected integer.")); + addError(numberLit->firstSourceLocation(), Tr::tr("Expected integer.")); return; } @@ -593,13 +594,13 @@ void TypeDescriptionReader::readEnumValues(AST::UiScriptBinding *ast, LanguageUt if (!ast) return; if (!ast->statement) { - addError(ast->colonToken, tr("Expected object literal after colon.")); + addError(ast->colonToken, Tr::tr("Expected object literal after colon.")); return; } auto *expStmt = AST::cast(ast->statement); if (!expStmt) { - addError(ast->statement->firstSourceLocation(), tr("Expected expression after colon.")); + addError(ast->statement->firstSourceLocation(), Tr::tr("Expected expression after colon.")); return; } @@ -611,7 +612,7 @@ void TypeDescriptionReader::readEnumValues(AST::UiScriptBinding *ast, LanguageUt continue; } } - addError(it->firstSourceLocation(), tr("Expected strings as enum keys.")); + addError(it->firstSourceLocation(), Tr::tr("Expected strings as enum keys.")); } } else if (auto *arrayLit = AST::cast(expStmt->expression)) { for (PatternElementList *it = arrayLit->elements; it; it = it->next) { @@ -621,10 +622,10 @@ void TypeDescriptionReader::readEnumValues(AST::UiScriptBinding *ast, LanguageUt continue; } } - addError(it->firstSourceLocation(), tr("Expected strings as enum keys.")); + addError(it->firstSourceLocation(), Tr::tr("Expected strings as enum keys.")); } } else { addError(ast->statement->firstSourceLocation(), - tr("Expected either array or object literal as enum definition.")); + Tr::tr("Expected either array or object literal as enum definition.")); } } diff --git a/src/libs/qmljs/qmljstypedescriptionreader.h b/src/libs/qmljs/qmljstypedescriptionreader.h index 478b9d15f8f..10b7b50b38a 100644 --- a/src/libs/qmljs/qmljstypedescriptionreader.h +++ b/src/libs/qmljs/qmljstypedescriptionreader.h @@ -8,9 +8,6 @@ #include -// for Q_DECLARE_TR_FUNCTIONS -#include - QT_BEGIN_NAMESPACE class QIODevice; class QBuffer; @@ -28,8 +25,6 @@ class UiScriptBinding; class QMLJS_EXPORT TypeDescriptionReader { - Q_DECLARE_TR_FUNCTIONS(QmlJS::TypeDescriptionReader) - public: explicit TypeDescriptionReader(const QString &fileName, const QString &data); ~TypeDescriptionReader(); diff --git a/src/plugins/qmldesigner/designercore/include/metainforeader.h b/src/plugins/qmldesigner/designercore/include/metainforeader.h index 129e2389b77..4b4a3837e34 100644 --- a/src/plugins/qmldesigner/designercore/include/metainforeader.h +++ b/src/plugins/qmldesigner/designercore/include/metainforeader.h @@ -8,6 +8,7 @@ #include +#include #include