summaryrefslogtreecommitdiffstats
path: root/src/linguist/lupdate/qdeclarative.cpp
diff options
context:
space:
mode:
authorLucie Gérard <lucie.gerard@qt.io>2023-10-13 16:29:11 +0200
committerLucie Gérard <lucie.gerard@qt.io>2023-10-31 14:21:19 +0200
commit8469be276e3da780856018f74c888c6e29ae7bd8 (patch)
treea47675658491de232663d52129f26de55d4c8831 /src/linguist/lupdate/qdeclarative.cpp
parentb2bcf0399c22dc3e253527a69ae0c5242a61f9fb (diff)
lupdate: Add using pragma to control translation context in qml file
Also add testing. It is now possible to control the translation context for a whole qml file using pragma Translator. Task-number: QTBUG-114528 Change-Id: I427cfb19993f417ab64bbc3c9c33a19128ca6d09 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/linguist/lupdate/qdeclarative.cpp')
-rw-r--r--src/linguist/lupdate/qdeclarative.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/linguist/lupdate/qdeclarative.cpp b/src/linguist/lupdate/qdeclarative.cpp
index 595ee7e7f..93ab76f9e 100644
--- a/src/linguist/lupdate/qdeclarative.cpp
+++ b/src/linguist/lupdate/qdeclarative.cpp
@@ -60,6 +60,16 @@ protected:
void accept(AST::Node *node)
{ AST::Node::accept(node, this); }
+ bool visit(AST::UiPragma *node) override
+ {
+ if (!node->name.isNull()) {
+ if (node->name == "Translator"_L1) {
+ m_component = node->values->value.toString();
+ }
+ }
+ return false;
+ }
+
void endVisit(AST::CallExpression *node) override
{
QString name;