diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2010-06-29 14:56:18 (GMT) |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2010-08-23 08:25:41 (GMT) |
commit | a5867a413d14f307c0f20b7080840b15bd8743e4 (patch) | |
tree | 31a592ea1c42065892ecb615c68729bb6ec3a804 /tools | |
parent | 1c4e3cf9870df591c60dc7d59df2b98b8eb534b0 (diff) | |
download | Qt-a5867a413d14f307c0f20b7080840b15bd8743e4.zip Qt-a5867a413d14f307c0f20b7080840b15bd8743e4.tar.gz Qt-a5867a413d14f307c0f20b7080840b15bd8743e4.tar.bz2 |
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')
-rw-r--r-- | tools/linguist/lupdate/qscript.cpp | 20 | ||||
-rw-r--r-- | tools/linguist/lupdate/qscript.g | 20 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tools/linguist/lupdate/qscript.cpp b/tools/linguist/lupdate/qscript.cpp index dc885a3..7ca0987 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 200b641..e4c2d22 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; ./ |