diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-10-13 03:06:50 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-10-13 03:06:50 (GMT) |
commit | 7aa4e177bbc01b7385cb345f3ad620a935dbe2d4 (patch) | |
tree | b26c775d71e25e1a5f6abc70e810f71bab8f6fb5 /src/declarative/qml/qmlcompiler.cpp | |
parent | 7a9dada31e570b2884c1c3c7a094ca9b1690c743 (diff) | |
download | Qt-7aa4e177bbc01b7385cb345f3ad620a935dbe2d4.zip Qt-7aa4e177bbc01b7385cb345f3ad620a935dbe2d4.tar.gz Qt-7aa4e177bbc01b7385cb345f3ad620a935dbe2d4.tar.bz2 |
i18n
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 143 |
1 files changed, 72 insertions, 71 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index fa7e473..c744509 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -60,6 +60,7 @@ #include <qmlcontext.h> #include <qmlmetatype.h> #include <QtCore/qdebug.h> +#include <QtGui/qapplication.h> #include "private/qmlcustomparser_p_p.h" #include <private/qmlcontext_p.h> #include <private/qmlcomponent_p.h> @@ -157,7 +158,7 @@ bool QmlCompiler::isSignalPropertyName(const QByteArray &name) For example: \code - COMPILE_EXCEPTION(property, tr("Error for property \"%1\"").arg(QString::fromUtf8(property->name))); + COMPILE_EXCEPTION(property, qApp->translate("QmlCompiler","Error for property \"%1\"").arg(QString::fromUtf8(property->name))); \endcode */ #define COMPILE_EXCEPTION(token, desc) \ @@ -193,7 +194,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop, QString string = v->value.asScript(); if (!prop.isWritable()) - COMPILE_EXCEPTION(v, tr("Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name()))); + COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name()))); if (prop.isEnumType()) { int value; @@ -202,7 +203,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop, } else value = prop.enumerator().keyToValue(string.toUtf8().constData()); if (value == -1) - COMPILE_EXCEPTION(v, tr("Invalid property assignment: unknown enumeration")); + COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: unknown enumeration")); return true; } int type = prop.userType(); @@ -210,61 +211,61 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop, case -1: break; case QVariant::String: - if (!v->value.isString()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: string expected")); + if (!v->value.isString()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: string expected")); break; case QVariant::Url: - if (!v->value.isString()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: url expected")); + if (!v->value.isString()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: url expected")); break; case QVariant::UInt: { bool ok; string.toUInt(&ok); - if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: unsigned int expected")); + if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: unsigned int expected")); } break; case QVariant::Int: { bool ok; string.toInt(&ok); - if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: int expected")); + if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: int expected")); } break; case QMetaType::Float: { bool ok; string.toFloat(&ok); - if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: float expected")); + if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: float expected")); } break; case QVariant::Double: { bool ok; string.toDouble(&ok); - if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: double expected")); + if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: double expected")); } break; case QVariant::Color: { QColor c = QmlStringConverters::colorFromString(string); - if (!c.isValid()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: color expected")); + if (!c.isValid()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: color expected")); } break; case QVariant::Date: { QDate d = QDate::fromString(string, Qt::ISODate); - if (!d.isValid()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: date expected")); + if (!d.isValid()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: date expected")); } break; case QVariant::Time: { QTime time = QTime::fromString(string, Qt::ISODate); - if (!time.isValid()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: time expected")); + if (!time.isValid()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: time expected")); } break; case QVariant::DateTime: { QDateTime dateTime = QDateTime::fromString(string, Qt::ISODate); - if (!dateTime.isValid()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: datetime expected")); + if (!dateTime.isValid()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: datetime expected")); } break; case QVariant::Point: @@ -272,7 +273,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop, { bool ok; QPointF point = QmlStringConverters::pointFFromString(string, &ok); - if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: point expected")); + if (!ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: point expected")); } break; case QVariant::Size: @@ -280,7 +281,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop, { bool ok; QSizeF size = QmlStringConverters::sizeFFromString(string, &ok); - if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: size expected")); + if (!ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: size expected")); } break; case QVariant::Rect: @@ -288,19 +289,19 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop, { bool ok; QRectF rect = QmlStringConverters::rectFFromString(string, &ok); - if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: rect expected")); + if (!ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: rect expected")); } break; case QVariant::Bool: { - if (!v->value.isBoolean()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: boolean expected")); + if (!v->value.isBoolean()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: boolean expected")); } break; case QVariant::Vector3D: { bool ok; QVector3D point = QmlStringConverters::vector3DFromString(string, &ok); - if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: 3D vector expected")); + if (!ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: 3D vector expected")); } break; default: @@ -311,7 +312,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop, QmlMetaType::StringConverter converter = QmlMetaType::customStringConverter(t); if (!converter) - COMPILE_EXCEPTION(v, tr("Invalid property assignment: unsupported type \"%1\"").arg(QString::fromLatin1(QVariant::typeToName(prop.type())))); + COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: unsupported type \"%1\"").arg(QString::fromLatin1(QVariant::typeToName(prop.type())))); } break; } @@ -1023,18 +1024,18 @@ bool QmlCompiler::buildComponent(QmlParser::Object *obj, if (obj->properties.count() > 1 || (obj->properties.count() == 1 && obj->properties.begin().key() != "id") || !obj->scriptBlockObjects.isEmpty()) - COMPILE_EXCEPTION(obj, tr("Invalid component specification")); + COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Invalid component specification")); if (obj->properties.count()) idProp = *obj->properties.begin(); if (idProp && (idProp->value || idProp->values.count() > 1 || !isValidId(idProp->values.first()->primitive()))) - COMPILE_EXCEPTION(obj, tr("Invalid component id specification")); + COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Invalid component id specification")); if (idProp) { QString idVal = idProp->values.first()->primitive(); if (compileState.ids.contains(idVal)) - COMPILE_EXCEPTION(obj, tr("id is not unique")); + COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","id is not unique")); obj->id = idVal; addId(idVal, obj); @@ -1044,14 +1045,14 @@ bool QmlCompiler::buildComponent(QmlParser::Object *obj, if (obj->defaultProperty && (obj->defaultProperty->value || obj->defaultProperty->values.count() > 1 || (obj->defaultProperty->values.count() == 1 && !obj->defaultProperty->values.first()->object))) - COMPILE_EXCEPTION(obj, tr("Invalid component body specification")); + COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Invalid component body specification")); Object *root = 0; if (obj->defaultProperty && obj->defaultProperty->values.count()) root = obj->defaultProperty->values.first()->object; if (!root) - COMPILE_EXCEPTION(obj, tr("Cannot create empty component specification")); + COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Cannot create empty component specification")); // Build the component tree COMPILE_CHECK(buildComponentFromRoot(root, ctxt)); @@ -1070,11 +1071,11 @@ bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script) Property *source = *script->properties.begin(); if (script->defaultProperty) - COMPILE_EXCEPTION(source, tr("Invalid Script block. Specify either the source property or inline script.")); + COMPILE_EXCEPTION(source, qApp->translate("QmlCompiler","Invalid Script block. Specify either the source property or inline script.")); if (source->value || source->values.count() != 1 || source->values.at(0)->object || !source->values.at(0)->value.isString()) - COMPILE_EXCEPTION(source, tr("Invalid Script source value")); + COMPILE_EXCEPTION(source, qApp->translate("QmlCompiler","Invalid Script source value")); sourceUrl = output->url.resolved(QUrl(source->values.at(0)->value.asString())).toString(); @@ -1086,7 +1087,7 @@ bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script) } } else if (!script->properties.isEmpty()) { - COMPILE_EXCEPTION(*script->properties.begin(), tr("Properties cannot be set on Script block")); + COMPILE_EXCEPTION(*script->properties.begin(), qApp->translate("QmlCompiler","Properties cannot be set on Script block")); } else if (script->defaultProperty) { sourceUrl = output->url.toString(); @@ -1097,7 +1098,7 @@ bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script) if (lineNumber == 1) lineNumber = v->location.start.line; if (v->object || !v->value.isString()) - COMPILE_EXCEPTION(v, tr("Invalid Script block")); + COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid Script block")); if (ii == 0) { currentLocation = v->location.start; @@ -1203,7 +1204,7 @@ bool QmlCompiler::buildSignal(QmlParser::Property *prop, QmlParser::Object *obj, Q_ASSERT(obj->metaObject()); if (prop->isEmpty()) - COMPILE_EXCEPTION(prop, tr("Empty property assignment")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Empty property assignment")); QByteArray name = prop->name; Q_ASSERT(name.startsWith("on")); @@ -1222,7 +1223,7 @@ bool QmlCompiler::buildSignal(QmlParser::Property *prop, QmlParser::Object *obj, } else { if (prop->value || prop->values.count() > 1) - COMPILE_EXCEPTION(prop, tr("Incorrectly specified signal")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Incorrectly specified signal")); prop->index = sigIdx; obj->addSignalProperty(prop); @@ -1267,7 +1268,7 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop, const BindingContext &ctxt) { if (prop->isEmpty()) - COMPILE_EXCEPTION(prop, tr("Empty property assignment")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Empty property assignment")); const QMetaObject *metaObject = obj->metaObject(); Q_ASSERT(metaObject); @@ -1279,7 +1280,7 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop, // Attached properties cannot be used on sub-objects. Sub-objects // always exist in a binding sub-context, which is what we test // for here. - COMPILE_EXCEPTION(prop, tr("Attached properties cannot be used here")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Attached properties cannot be used here")); } QmlType *type = 0; @@ -1294,11 +1295,11 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop, ctxt)); return true; } else if (!type || !type->attachedPropertiesType()) { - COMPILE_EXCEPTION(prop, tr("Non-existant attached object")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Non-existant attached object")); } if (!prop->value) - COMPILE_EXCEPTION(prop, tr("Invalid attached object assignment")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid attached object assignment")); Q_ASSERT(type->attachedPropertiesFunction()); prop->index = type->index(); @@ -1356,9 +1357,9 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop, } else if (prop->index == -1) { if (prop->isDefault) { - COMPILE_EXCEPTION(prop->values.first(), tr("Cannot assign to non-existant default property")); + COMPILE_EXCEPTION(prop->values.first(), qApp->translate("QmlCompiler","Cannot assign to non-existant default property")); } else { - COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name))); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name))); } } else if (prop->value) { @@ -1386,12 +1387,12 @@ QmlCompiler::buildPropertyInNamespace(QmlEnginePrivate::ImportedNamespace *ns, const BindingContext &ctxt) { if (!nsProp->value) - COMPILE_EXCEPTION(nsProp, tr("Invalid use of namespace")); + COMPILE_EXCEPTION(nsProp, qApp->translate("QmlCompiler","Invalid use of namespace")); foreach (Property *prop, nsProp->value->properties) { if (!isAttachedPropertyName(prop->name)) - COMPILE_EXCEPTION(prop, tr("Not an attached property name")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Not an attached property name")); // Setup attached property data @@ -1400,10 +1401,10 @@ QmlCompiler::buildPropertyInNamespace(QmlEnginePrivate::ImportedNamespace *ns, &type, 0, 0, 0); if (!type || !type->attachedPropertiesType()) - COMPILE_EXCEPTION(prop, tr("Non-existant attached object")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Non-existant attached object")); if (!prop->value) - COMPILE_EXCEPTION(prop, tr("Invalid attached object assignment")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid attached object assignment")); Q_ASSERT(type->attachedPropertiesFunction()); prop->index = type->index(); @@ -1575,13 +1576,13 @@ bool QmlCompiler::buildIdProperty(QmlParser::Property *prop, if (prop->value || prop->values.count() > 1 || prop->values.at(0)->object) - COMPILE_EXCEPTION(prop, tr("Invalid use of id property")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid use of id property")); QmlParser::Value *idValue = prop->values.at(0); QString val = idValue->primitive(); if (!isValidId(val)) - COMPILE_EXCEPTION(prop, tr("\"%1\" is not a valid object id").arg(val)); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","\"%1\" is not a valid object id").arg(val)); // We disallow id's that conflict with import prefixes and types QmlEnginePrivate::ImportedNamespace *ns = 0; @@ -1589,12 +1590,12 @@ bool QmlCompiler::buildIdProperty(QmlParser::Property *prop, QmlEnginePrivate::get(engine)->resolveType(unit->imports, val.toUtf8(), &type, 0, 0, 0, &ns); if (type) - COMPILE_EXCEPTION(idValue, tr("id conflicts with type name")); + COMPILE_EXCEPTION(idValue, qApp->translate("QmlCompiler","id conflicts with type name")); if (ns) - COMPILE_EXCEPTION(idValue, tr("id conflicts with namespace prefix")); + COMPILE_EXCEPTION(idValue, qApp->translate("QmlCompiler","id conflicts with namespace prefix")); if (compileState.ids.contains(val)) - COMPILE_EXCEPTION(prop, tr("id is not unique")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","id is not unique")); prop->values.at(0)->type = Value::Id; @@ -1675,7 +1676,7 @@ bool QmlCompiler::buildGroupedProperty(QmlParser::Property *prop, prop->value, obj, ctxt.incr())); obj->addValueTypeProperty(prop); } else { - COMPILE_EXCEPTION(prop, tr("Invalid property access")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid property access")); } } else { @@ -1683,7 +1684,7 @@ bool QmlCompiler::buildGroupedProperty(QmlParser::Property *prop, prop->value->metatype = QmlEnginePrivate::get(engine)->metaObjectForType(prop->type); if (!prop->value->metatype) - COMPILE_EXCEPTION(prop, tr("Cannot nest non-QObject property \"%1\"").arg(QString::fromUtf8(prop->name))); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Cannot nest non-QObject property \"%1\"").arg(QString::fromUtf8(prop->name))); obj->addGroupedProperty(prop); @@ -1699,19 +1700,19 @@ bool QmlCompiler::buildValueTypeProperty(QObject *type, const BindingContext &ctxt) { if (obj->defaultProperty) - COMPILE_EXCEPTION(obj, tr("Invalid property use")); + COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Invalid property use")); obj->metatype = type->metaObject(); foreach (Property *prop, obj->properties) { int idx = type->metaObject()->indexOfProperty(prop->name.constData()); if (idx == -1) - COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name))); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name))); QMetaProperty p = type->metaObject()->property(idx); prop->index = idx; prop->type = p.userType(); if (prop->value || prop->values.count() != 1) - COMPILE_EXCEPTION(prop, tr("Invalid property use")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid property use")); Value *value = prop->values.at(0); @@ -1719,7 +1720,7 @@ bool QmlCompiler::buildValueTypeProperty(QObject *type, bool isPropertyValue = output->types.at(value->object->type).type->propertyValueSourceCast() != -1; bool isPropertyInterceptor = output->types.at(value->object->type).type->propertyValueInterceptorCast() != -1; if (!isPropertyValue && !isPropertyInterceptor) { - COMPILE_EXCEPTION(prop, tr("Invalid property use")); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid property use")); } else { COMPILE_CHECK(buildObject(value->object, ctxt)); @@ -1777,12 +1778,12 @@ bool QmlCompiler::buildListProperty(QmlParser::Property *prop, // at runtime. if (!listTypeIsInterface) { if (!canCoerce(listType, v->object)) { - COMPILE_EXCEPTION(v, tr("Cannot assign object to list")); + COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Cannot assign object to list")); } } } else { - COMPILE_EXCEPTION(v, tr("Cannot assign primitives to lists")); + COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Cannot assign primitives to lists")); } } @@ -1801,19 +1802,19 @@ bool QmlCompiler::buildListProperty(QmlParser::Property *prop, // at runtime. if (!listTypeIsInterface) { if (!canCoerce(listType, v->object)) { - COMPILE_EXCEPTION(v, tr("Cannot assign object to list")); + COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Cannot assign object to list")); } } } else if (v->value.isScript()) { if (assignedBinding) - COMPILE_EXCEPTION(v, tr("Can only assign one binding to lists")); + COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Can only assign one binding to lists")); assignedBinding = true; COMPILE_CHECK(buildBinding(v, prop, ctxt)); v->type = Value::PropertyBinding; } else { - COMPILE_EXCEPTION(v, tr("Cannot assign primitives to lists")); + COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Cannot assign primitives to lists")); } } @@ -1941,7 +1942,7 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop, buildDynamicMeta(prop->parent, ForceCreation); v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor; } else { - COMPILE_EXCEPTION(v->object, tr("Cannot assign object to property")); + COMPILE_EXCEPTION(v->object, qApp->translate("QmlCompiler","Cannot assign object to property")); } } @@ -1986,12 +1987,12 @@ bool QmlCompiler::checkDynamicMeta(QmlParser::Object *obj) if (prop.isDefaultProperty) { if (seenDefaultProperty) - COMPILE_EXCEPTION(obj, tr("Duplicate default property")); + COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Duplicate default property")); seenDefaultProperty = true; } if (propNames.contains(prop.name)) - COMPILE_EXCEPTION(obj, tr("Duplicate property name")); + COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Duplicate property name")); propNames.insert(prop.name); } @@ -1999,13 +2000,13 @@ bool QmlCompiler::checkDynamicMeta(QmlParser::Object *obj) for (int ii = 0; ii < obj->dynamicSignals.count(); ++ii) { QByteArray name = obj->dynamicSignals.at(ii).name; if (methodNames.contains(name)) - COMPILE_EXCEPTION(obj, tr("Duplicate signal name")); + COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Duplicate signal name")); methodNames.insert(name); } for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) { QByteArray name = obj->dynamicSlots.at(ii).name; if (methodNames.contains(name)) - COMPILE_EXCEPTION(obj, tr("Duplicate method name")); + COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Duplicate method name")); methodNames.insert(name); } @@ -2027,7 +2028,7 @@ bool QmlCompiler::mergeDynamicMetaProperties(QmlParser::Object *obj) property = obj->getProperty(p.name); if (property->value) - COMPILE_EXCEPTION(property, tr("Invalid property nesting")); + COMPILE_EXCEPTION(property, qApp->translate("QmlCompiler","Invalid property nesting")); for (int ii = 0; ii < p.defaultValue->values.count(); ++ii) { Value *v = p.defaultValue->values.at(ii); @@ -2073,7 +2074,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode) if (-1 != propIdx) { QMetaProperty prop = obj->metaObject()->property(propIdx); if (prop.isFinal()) - COMPILE_EXCEPTION(&p, tr("Cannot override FINAL property")); + COMPILE_EXCEPTION(&p, qApp->translate("QmlCompiler","Cannot override FINAL property")); } if (p.isDefaultProperty && @@ -2098,7 +2099,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode) QmlEnginePrivate *priv = QmlEnginePrivate::get(engine); if (!priv->resolveType(unit->imports, p.customType, &qmltype, &url, 0, 0, 0)) - COMPILE_EXCEPTION(&p, tr("Invalid property type")); + COMPILE_EXCEPTION(&p, qApp->translate("QmlCompiler","Invalid property type")); if (!qmltype) { QmlCompositeTypeData *tdata = priv->typeManager.get(url); @@ -2257,24 +2258,24 @@ bool QmlCompiler::compileAlias(QMetaObjectBuilder &builder, const Object::DynamicProperty &prop) { if (!prop.defaultValue) - COMPILE_EXCEPTION(obj, tr("No property alias location")); + COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","No property alias location")); if (prop.defaultValue->values.count() != 1 || prop.defaultValue->values.at(0)->object || !prop.defaultValue->values.at(0)->value.isScript()) - COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location")); + COMPILE_EXCEPTION(prop.defaultValue, qApp->translate("QmlCompiler","Invalid alias location")); QmlJS::AST::Node *node = prop.defaultValue->values.at(0)->value.asAST(); if (!node) - COMPILE_EXCEPTION(obj, tr("No property alias location")); // ### Can this happen? + COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","No property alias location")); // ### Can this happen? QStringList alias = astNodeToStringList(node); if (alias.count() != 1 && alias.count() != 2) - COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location")); + COMPILE_EXCEPTION(prop.defaultValue, qApp->translate("QmlCompiler","Invalid alias location")); if (!compileState.ids.contains(alias.at(0))) - COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location")); + COMPILE_EXCEPTION(prop.defaultValue, qApp->translate("QmlCompiler","Invalid alias location")); Object *idObject = compileState.ids[alias.at(0)]; @@ -2286,7 +2287,7 @@ bool QmlCompiler::compileAlias(QMetaObjectBuilder &builder, propIdx = idObject->metaObject()->indexOfProperty(alias.at(1).toUtf8().constData()); if (-1 == propIdx) - COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location")); + COMPILE_EXCEPTION(prop.defaultValue, qApp->translate("QmlCompiler","Invalid alias location")); QMetaProperty aliasProperty = idObject->metaObject()->property(propIdx); writable = aliasProperty.isWritable(); @@ -2321,7 +2322,7 @@ bool QmlCompiler::buildBinding(QmlParser::Value *value, QMetaProperty mp = prop->parent->metaObject()->property(prop->index); if (!mp.isWritable() && !QmlMetaType::isList(prop->type)) - COMPILE_EXCEPTION(prop, tr("Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name))); + COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name))); BindingReference reference; reference.expression = value->value; |