summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2019-06-07 16:00:59 +0200
committerKai Koehne <kai.koehne@qt.io>2019-09-04 11:22:51 +0200
commit3480921b44f7a4dc8a38656a9722c1507a1b840a (patch)
tree2d1fdf3c7550cfacdabc215754659b6afd56fccc /src
parent121887b051150af7490f79402248e92c7d7d0f0a (diff)
downloadqttools-3480921b44f7a4dc8a38656a9722c1507a1b840a.tar.gz
lupdate: Warn about calls with template literals
JS template literals do not really mix well with the Qt Linguist toochain, at least if template arguments are used: This makes the source string dynamic. So far qsTr(``) calls were just ignored. Now lupdate prints a warning. Task-number: QTBUG-76265 Change-Id: I935c382695a86ecd6fd076b31a68fa987be8fd84 Reviewed-by: Lucie Gerard <lucie.gerard@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/linguist/lupdate/qdeclarative.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/linguist/lupdate/qdeclarative.cpp b/src/linguist/lupdate/qdeclarative.cpp
index fa8ad260e..707ea0b79 100644
--- a/src/linguist/lupdate/qdeclarative.cpp
+++ b/src/linguist/lupdate/qdeclarative.cpp
@@ -112,6 +112,10 @@ protected:
yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name));
return;
}
+ if (AST::cast<AST::TemplateLiteral *>(node->arguments->expression)) {
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1() cannot be used with template literals. Ignoring\n").arg(name));
+ return;
+ }
QString source;
if (!createString(node->arguments->expression, &source))