From 12180c397a2007970978033928b4b5b12efad7c6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 15 Feb 2010 14:55:59 +0100 Subject: Prepare translations of the declarative module. Add to translations profile. move stuff out of QObject-context, correct spelling and contractions, correct usage of tr(). --- .../graphicsitems/qmlgraphicsanchors.cpp | 26 +++++++++++----------- src/declarative/qml/qmlcompiler.cpp | 12 +++++----- src/declarative/qml/qmlobjectscriptclass.cpp | 6 ++--- src/declarative/util/qmlanimation.cpp | 14 ++++++------ src/declarative/util/qmlbehavior.cpp | 2 +- src/declarative/util/qmlpropertychanges.cpp | 2 +- src/declarative/util/qmlstateoperations.cpp | 8 +++---- src/declarative/util/qmlxmllistmodel.cpp | 4 ++-- translations/translations.pri | 1 + 9 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp index 93055fc..945e7d3 100644 --- a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp @@ -366,7 +366,7 @@ void QmlGraphicsAnchors::setFill(QmlGraphicsItem *f) return; } if (f != d->item->parentItem() && f->parentItem() != d->item->parentItem()){ - qmlInfo(d->item) << tr("Can't anchor to an item that isn't a parent or sibling."); + qmlInfo(d->item) << tr("Cannot anchor to an item that isn't a parent or sibling."); return; } d->remDepend(d->fill); @@ -400,7 +400,7 @@ void QmlGraphicsAnchors::setCenterIn(QmlGraphicsItem* c) return; } if (c != d->item->parentItem() && c->parentItem() != d->item->parentItem()){ - qmlInfo(d->item) << tr("Can't anchor to an item that isn't a parent or sibling."); + qmlInfo(d->item) << tr("Cannot anchor to an item that isn't a parent or sibling."); return; } @@ -991,7 +991,7 @@ bool QmlGraphicsAnchorsPrivate::checkHValid() const if (usedAnchors & QmlGraphicsAnchors::HasLeftAnchor && usedAnchors & QmlGraphicsAnchors::HasRightAnchor && usedAnchors & QmlGraphicsAnchors::HasHCenterAnchor) { - qmlInfo(item) << QmlGraphicsAnchors::tr("Can't specify left, right, and hcenter anchors."); + qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot specify left, right, and hcenter anchors."); return false; } @@ -1001,16 +1001,16 @@ bool QmlGraphicsAnchorsPrivate::checkHValid() const bool QmlGraphicsAnchorsPrivate::checkHAnchorValid(QmlGraphicsAnchorLine anchor) const { if (!anchor.item) { - qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to a null item."); + qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to a null item."); return false; } else if (anchor.anchorLine & QmlGraphicsAnchorLine::Vertical_Mask) { - qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor a horizontal edge to a vertical edge."); + qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor a horizontal edge to a vertical edge."); return false; } else if (anchor.item != item->parentItem() && anchor.item->parentItem() != item->parentItem()){ - qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to an item that isn't a parent or sibling."); + qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to an item that isn't a parent or sibling."); return false; } else if (anchor.item == item) { - qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor item to self."); + qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor item to self."); return false; } @@ -1022,13 +1022,13 @@ bool QmlGraphicsAnchorsPrivate::checkVValid() const if (usedAnchors & QmlGraphicsAnchors::HasTopAnchor && usedAnchors & QmlGraphicsAnchors::HasBottomAnchor && usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor) { - qmlInfo(item) << QmlGraphicsAnchors::tr("Can't specify top, bottom, and vcenter anchors."); + qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot specify top, bottom, and vcenter anchors."); return false; } else if (usedAnchors & QmlGraphicsAnchors::HasBaselineAnchor && (usedAnchors & QmlGraphicsAnchors::HasTopAnchor || usedAnchors & QmlGraphicsAnchors::HasBottomAnchor || usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor)) { - qmlInfo(item) << QmlGraphicsAnchors::tr("Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors."); + qmlInfo(item) << QmlGraphicsAnchors::tr("Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors."); return false; } @@ -1038,16 +1038,16 @@ bool QmlGraphicsAnchorsPrivate::checkVValid() const bool QmlGraphicsAnchorsPrivate::checkVAnchorValid(QmlGraphicsAnchorLine anchor) const { if (!anchor.item) { - qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to a null item."); + qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to a null item."); return false; } else if (anchor.anchorLine & QmlGraphicsAnchorLine::Horizontal_Mask) { - qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor a vertical edge to a horizontal edge."); + qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor a vertical edge to a horizontal edge."); return false; } else if (anchor.item != item->parentItem() && anchor.item->parentItem() != item->parentItem()){ - qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to an item that isn't a parent or sibling."); + qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to an item that isn't a parent or sibling."); return false; } else if (anchor.item == item){ - qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor item to self."); + qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor item to self."); return false; } diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 10150de..9990c06 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -730,7 +730,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt) compileState.parserStatusCount++; // Check if this is a custom parser type. Custom parser types allow - // assignments to non-existant properties. These assignments are then + // assignments to non-existent properties. These assignments are then // compiled by the type. bool isCustomParser = output->types.at(obj->type).type && output->types.at(obj->type).type->customParser() != 0; @@ -1429,7 +1429,7 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop, ctxt)); return true; } else if (!type || !type->attachedPropertiesType()) { - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existant attached object")); + COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existent attached object")); } if (!prop->value) @@ -1486,9 +1486,9 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop, } else if (prop->index == -1) { if (prop->isDefault) { - COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QmlCompiler","Cannot assign to non-existant default property")); + COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QmlCompiler","Cannot assign to non-existent default property")); } else { - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name))); + COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name))); } } else if (prop->value) { @@ -1534,7 +1534,7 @@ QmlCompiler::buildPropertyInNamespace(QmlEnginePrivate::ImportedNamespace *ns, &type, 0, 0, 0); if (!type || !type->attachedPropertiesType()) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existant attached object")); + COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existent attached object")); if (!prop->value) COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid attached object assignment")); @@ -1841,7 +1841,7 @@ bool QmlCompiler::buildValueTypeProperty(QObject *type, foreach (Property *prop, obj->properties) { int idx = type->metaObject()->indexOfProperty(prop->name.constData()); if (idx == -1) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name))); + COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name))); QMetaProperty p = type->metaObject()->property(idx); prop->index = idx; prop->type = p.userType(); diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp index 1c41d46..c373a8e 100644 --- a/src/declarative/qml/qmlobjectscriptclass.cpp +++ b/src/declarative/qml/qmlobjectscriptclass.cpp @@ -313,7 +313,7 @@ void QmlObjectScriptClass::setProperty(QObject *obj, Q_ASSERT(lastData); if (!lastData->isValid()) { - QString error = QLatin1String("Cannot assign to non-existant property \"") + + QString error = QLatin1String("Cannot assign to non-existent property \"") + toString(name) + QLatin1Char('\"'); if (context()) context()->throwError(error); @@ -628,11 +628,11 @@ QmlObjectMethodScriptClass::Value QmlObjectMethodScriptClass::call(Object *o, QS for (int ii = 0; ii < argTypeNames.count(); ++ii) { argTypes[ii] = QMetaType::type(argTypeNames.at(ii)); if (argTypes[ii] == QVariant::Invalid) - return Value(ctxt, ctxt->throwError(QString(QLatin1String("Unknown method parameter type: %1")).arg(QLatin1String(argTypeNames.at(ii))))); + return Value(ctxt, ctxt->throwError(QString::fromLatin1("Unknown method parameter type: %1").arg(QLatin1String(argTypeNames.at(ii))))); } if (argTypes.count() > ctxt->argumentCount()) - return Value(ctxt, ctxt->throwError("Insufficient arguments")); + return Value(ctxt, ctxt->throwError(QLatin1String("Insufficient arguments"))); QVarLengthArray args(argTypes.count() + 1); args[0].initAsType(method->data.propType, engine); diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index abffefe..6609c73 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -77,7 +77,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj) if (hasParams) { QString easeName = curve.trimmed(); if (!easeName.endsWith(QLatin1Char(')'))) { - qmlInfo(obj) << obj->tr("Unmatched parenthesis in easing function \"%1\"").arg(curve); + qmlInfo(obj) << QmlPropertyAnimation::tr("Unmatched parenthesis in easing function \"%1\"").arg(curve); return easingCurve; } @@ -86,7 +86,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj) easeName.mid(idx + 1, easeName.length() - 1 - idx - 1); normalizedCurve = easeName.left(idx); if (!normalizedCurve.startsWith(QLatin1String("ease"))) { - qmlInfo(obj) << obj->tr("Easing function \"%1\" must start with \"ease\"").arg(curve); + qmlInfo(obj) << QmlPropertyAnimation::tr("Easing function \"%1\" must start with \"ease\"").arg(curve); return easingCurve; } @@ -101,7 +101,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj) int value = me.keyToValue(normalizedCurve.toUtf8().constData()); if (value < 0) { - qmlInfo(obj) << obj->tr("Unknown easing curve \"%1\"").arg(curve); + qmlInfo(obj) << QmlPropertyAnimation::tr("Unknown easing curve \"%1\"").arg(curve); return easingCurve; } easingCurve.setType((QEasingCurve::Type)value); @@ -111,7 +111,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj) int sep = str.indexOf(QLatin1Char(':')); if (sep == -1) { - qmlInfo(obj) << obj->tr("Improperly specified parameter in easing function \"%1\"").arg(curve); + qmlInfo(obj) << QmlPropertyAnimation::tr("Improperly specified parameter in easing function \"%1\"").arg(curve); continue; } @@ -120,7 +120,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj) qreal propValue = str.mid(sep + 1).trimmed().toDouble(&isOk); if (propName.isEmpty() || !isOk) { - qmlInfo(obj) << obj->tr("Improperly specified parameter in easing function \"%1\"").arg(curve); + qmlInfo(obj) << QmlPropertyAnimation::tr("Improperly specified parameter in easing function \"%1\"").arg(curve); continue; } @@ -131,7 +131,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj) } else if (propName == QLatin1String("overshoot")) { easingCurve.setOvershoot(propValue); } else { - qmlInfo(obj) << obj->tr("Unknown easing parameter \"%1\"").arg(propName); + qmlInfo(obj) << QmlPropertyAnimation::tr("Unknown easing parameter \"%1\"").arg(propName); continue; } } @@ -226,7 +226,7 @@ QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const { QmlMetaProperty prop = QmlMetaProperty::createProperty(obj, str, qmlContext(infoObj)); if (!prop.isValid()) { - qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate non-existant property \"%1\"").arg(str); + qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate non-existent property \"%1\"").arg(str); return QmlMetaProperty(); } else if (!prop.isWritable()) { qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str); diff --git a/src/declarative/util/qmlbehavior.cpp b/src/declarative/util/qmlbehavior.cpp index b9c77f5..e8feeaa 100644 --- a/src/declarative/util/qmlbehavior.cpp +++ b/src/declarative/util/qmlbehavior.cpp @@ -119,7 +119,7 @@ void QmlBehavior::setAnimation(QmlAbstractAnimation *animation) { Q_D(QmlBehavior); if (d->animation) { - qmlInfo(this) << tr("Can't change the animation assigned to a Behavior."); + qmlInfo(this) << tr("Cannot change the animation assigned to a Behavior."); return; } diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp index 68fc5cc..f1f39da 100644 --- a/src/declarative/util/qmlpropertychanges.cpp +++ b/src/declarative/util/qmlpropertychanges.cpp @@ -357,7 +357,7 @@ QmlPropertyChangesPrivate::property(const QByteArray &property) Q_Q(QmlPropertyChanges); QmlMetaProperty prop = QmlMetaProperty::createProperty(object, QString::fromUtf8(property)); if (!prop.isValid()) { - qmlInfo(q) << QmlPropertyChanges::tr("Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(property)); + qmlInfo(q) << QmlPropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(property)); return QmlMetaProperty(); } else if (!(prop.type() & QmlMetaProperty::SignalProperty) && !prop.isWritable()) { qmlInfo(q) << QmlPropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(QString::fromUtf8(property)); diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index 35c8f7d..cefe2bc 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -82,7 +82,7 @@ void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphics bool ok; const QTransform &transform = target->itemTransform(targetParent, &ok); if (transform.type() >= QTransform::TxShear || !ok) { - qmlInfo(q) << QObject::tr("Unable to preserve appearance under complex transform"); + qmlInfo(q) << QmlParentChange::tr("Unable to preserve appearance under complex transform"); ok = false; } @@ -92,21 +92,21 @@ void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphics if (transform.m11() == transform.m22()) scale = transform.m11(); else { - qmlInfo(q) << QObject::tr("Unable to preserve appearance under non-uniform scale"); + qmlInfo(q) << QmlParentChange::tr("Unable to preserve appearance under non-uniform scale"); ok = false; } } else if (ok && transform.type() == QTransform::TxRotate) { if (transform.m11() == transform.m22()) scale = qSqrt(transform.m11()*transform.m11() + transform.m12()*transform.m12()); else { - qmlInfo(q) << QObject::tr("Unable to preserve appearance under non-uniform scale"); + qmlInfo(q) << QmlParentChange::tr("Unable to preserve appearance under non-uniform scale"); ok = false; } if (scale != 0) rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI; else { - qmlInfo(q) << QObject::tr("Unable to preserve appearance under scale of 0"); + qmlInfo(q) << QmlParentChange::tr("Unable to preserve appearance under scale of 0"); ok = false; } } diff --git a/src/declarative/util/qmlxmllistmodel.cpp b/src/declarative/util/qmlxmllistmodel.cpp index d31fadf..d586792 100644 --- a/src/declarative/util/qmlxmllistmodel.cpp +++ b/src/declarative/util/qmlxmllistmodel.cpp @@ -391,7 +391,7 @@ void QmlXmlRoleList::insert(int i, QmlXmlListModelRole *role) { QmlConcreteList::insert(i, role); if (model->roleNames.contains(role->name())) { - qmlInfo(role) << QObject::tr("\"%1\" duplicates a previous role name and will be disabled.").arg(role->name()); + qmlInfo(role) << QCoreApplication::translate("QmlXmlRoleList", "\"%1\" duplicates a previous role name and will be disabled.").arg(role->name()); return; } model->roles.insert(i, model->highestRole); @@ -551,7 +551,7 @@ void QmlXmlListModel::setQuery(const QString &query) { Q_D(QmlXmlListModel); if (!query.startsWith(QLatin1Char('/'))) { - qmlInfo(this) << tr("An XmlListModel query must start with '/' or \"//\""); + qmlInfo(this) << QCoreApplication::translate("QmlXmlRoleList", "An XmlListModel query must start with '/' or \"//\""); return; } diff --git a/translations/translations.pri b/translations/translations.pri index 808dc4f..a8fb7ee 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -25,6 +25,7 @@ ts-qt.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ 3rdparty/webkit \ activeqt \ corelib \ + declarative \ gui \ multimedia \ network \ -- cgit v0.12