diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-03-22 12:57:19 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-03-25 22:22:43 +0000 |
commit | 5ce1b892a14a9940e4c8abbbed69bc011394c617 (patch) | |
tree | 0ad456596e50a9cf30f5f3b45675a48118360e32 /src/qml/qml/qqmlimport.cpp | |
parent | a34db672a6dd30587b55a27927bdd85c3c4a89a7 (diff) |
QQmlImportDatabase: Introduce utility message function.
Reduces the number of messages that need to be translated.
Change-Id: I986d3202ac2dcc6c8e197e19c735dd66dad37f39
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 0014ccd3ba..d6c81bcc49 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -888,6 +888,11 @@ bool QQmlImportsPrivate::populatePluginPairVector(QVector<StaticPluginPair> &res } #endif +static inline QString msgCannotLoadPlugin(const QString &uri, const QString &why) +{ + return QQmlImportDatabase::tr("plugin cannot be loaded for module \"%1\": %2").arg(uri, why); +} + /*! Import an extension defined by a qmldir file. @@ -949,7 +954,7 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath, // The reason is that the lower level may add url and line/column numbering information. QQmlError poppedError = errors->takeFirst(); QQmlError error; - error.setDescription(QQmlImportDatabase::tr("plugin cannot be loaded for module \"%1\": %2").arg(uri).arg(poppedError.description())); + error.setDescription(msgCannotLoadPlugin(uri, poppedError.description())); error.setUrl(QUrl::fromLocalFile(qmldirFilePath)); errors->prepend(error); } @@ -1020,10 +1025,7 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath, if (errors) { QQmlError error; - error.setDescription( - QQmlImportDatabase::tr( - "plugin cannot be loaded for module \"%1\": library loading is disabled") - .arg(uri)); + error.setDescription(msgCannotLoadPlugin(uri, QQmlImportDatabase::tr("library loading is disabled"))); error.setUrl(QUrl::fromLocalFile(qmldirFilePath)); errors->prepend(error); } |