summaryrefslogtreecommitdiff
path: root/tools/linguist/lupdate
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-06-29 16:56:18 +0200
committerKent Hansen <kent.hansen@nokia.com>2010-08-23 10:25:41 +0200
commita5867a413d14f307c0f20b7080840b15bd8743e4 (patch)
tree31a592ea1c42065892ecb615c68729bb6ec3a804 /tools/linguist/lupdate
parent1c4e3cf9870df591c60dc7d59df2b98b8eb534b0 (diff)
downloadqt4-tools-a5867a413d14f307c0f20b7080840b15bd8743e4.tar.gz
Make lupdate's QtScript frontend recognize qsTrId() / QT_TRID_NOOP()
Extracting the translation data is only the first step; a separate commit will make the functions available in the QtScript runtime. Task-number: QTBUG-8454 Reviewed-by: Oswald Buddenhagen
Diffstat (limited to 'tools/linguist/lupdate')
-rw-r--r--tools/linguist/lupdate/qscript.cpp20
-rw-r--r--tools/linguist/lupdate/qscript.g20
2 files changed, 40 insertions, 0 deletions
diff --git a/tools/linguist/lupdate/qscript.cpp b/tools/linguist/lupdate/qscript.cpp
index dc885a379c..7ca09875c7 100644
--- a/tools/linguist/lupdate/qscript.cpp
+++ b/tools/linguist/lupdate/qscript.cpp
@@ -2310,6 +2310,26 @@ case 66: {
extracomment.clear();
msgid.clear();
extra.clear();
+ } else if ((name == QLatin1String("qsTrId")) || (name == QLatin1String("QT_TRID_NOOP"))) {
+ if (!msgid.isEmpty())
+ yyMsg(identLineNo) << "//= cannot be used with " << qPrintable(name) << "(). Ignoring\n";
+ QVariantList args = sym(2).toList();
+ if (args.size() < 1) {
+ yyMsg(identLineNo) << qPrintable(name) << "() requires at least one argument.\n";
+ } else {
+ if (args.at(0).type() != QVariant::String) {
+ yyMsg(identLineNo) << qPrintable(name) << "(): identifier must be a literal string.\n";
+ } else {
+ msgid = args.at(0).toString();
+ bool plural = (args.size() > 1);
+ recordMessage(translator, QString(), sourcetext, QString(), extracomment,
+ msgid, extra, plural, fileName(), identLineNo);
+ }
+ }
+ sourcetext.clear();
+ extracomment.clear();
+ msgid.clear();
+ extra.clear();
}
} break;
diff --git a/tools/linguist/lupdate/qscript.g b/tools/linguist/lupdate/qscript.g
index 200b6416cf..e4c2d2276a 100644
--- a/tools/linguist/lupdate/qscript.g
+++ b/tools/linguist/lupdate/qscript.g
@@ -1726,6 +1726,26 @@ case $rule_number: {
extracomment.clear();
msgid.clear();
extra.clear();
+ } else if ((name == QLatin1String("qsTrId")) || (name == QLatin1String("QT_TRID_NOOP"))) {
+ if (!msgid.isEmpty())
+ yyMsg(identLineNo) << "//= cannot be used with " << qPrintable(name) << "(). Ignoring\n";
+ QVariantList args = sym(2).toList();
+ if (args.size() < 1) {
+ yyMsg(identLineNo) << qPrintable(name) << "() requires at least one argument.\n";
+ } else {
+ if (args.at(0).type() != QVariant::String) {
+ yyMsg(identLineNo) << qPrintable(name) << "(): identifier must be a literal string.\n";
+ } else {
+ msgid = args.at(0).toString();
+ bool plural = (args.size() > 1);
+ recordMessage(translator, QString(), sourcetext, QString(), extracomment,
+ msgid, extra, plural, fileName(), identLineNo);
+ }
+ }
+ sourcetext.clear();
+ extracomment.clear();
+ msgid.clear();
+ extra.clear();
}
} break;
./