diff options
author | Lucie Gérard <lucie.gerard@qt.io> | 2023-10-13 16:29:11 +0200 |
---|---|---|
committer | Lucie Gérard <lucie.gerard@qt.io> | 2023-10-31 14:21:19 +0200 |
commit | 8469be276e3da780856018f74c888c6e29ae7bd8 (patch) | |
tree | a47675658491de232663d52129f26de55d4c8831 /src/linguist/lupdate/qdeclarative.cpp | |
parent | b2bcf0399c22dc3e253527a69ae0c5242a61f9fb (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.cpp | 10 |
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; |