diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-06-24 10:15:16 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-06-24 09:22:42 +0000 |
commit | 1e589e37a991b29076e9a661f92dfa178421c208 (patch) | |
tree | ccdae70edb75b1bc17f0efc61086e16554e3f4eb /src/libs/installer/installiconsoperation.cpp | |
parent | 65a5d4d33c7dcb27ce99ce59535733a28991c544 (diff) |
Unify translated error messages
* Enclose file paths in ""
* Localize file paths with QDir::toNativeSeparators.
* Make sure sentences end with a '.'
* Append error details always by ':', e.g.
tr("Failed to copy file '%1': %2").(...)
* Use 'directory' instead of 'folder' everywhere
Change-Id: Ie045f429f72ad5045c96537465c5fb9d2e99d250
Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Diffstat (limited to 'src/libs/installer/installiconsoperation.cpp')
-rw-r--r-- | src/libs/installer/installiconsoperation.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/libs/installer/installiconsoperation.cpp b/src/libs/installer/installiconsoperation.cpp index f9a9096f5..b6613cd5d 100644 --- a/src/libs/installer/installiconsoperation.cpp +++ b/src/libs/installer/installiconsoperation.cpp @@ -118,7 +118,7 @@ bool InstallIconsOperation::performOperation() if (source.isEmpty()) { setError(InvalidArguments); - setErrorString(tr("Invalid Argument: source folder must not be empty.")); + setErrorString(tr("Invalid Argument: source directory must not be empty.")); return false; } @@ -167,7 +167,8 @@ bool InstallIconsOperation::performOperation() QFile bf(target); if (!bf.copy(backup)) { setError(UserDefinedError); - setErrorString(tr("Could not backup file %1: %2").arg(target, bf.errorString())); + setErrorString(tr("Cannot backup file \"%1\": %2").arg( + QDir::toNativeSeparators(target), bf.errorString())); undoOperation(); return false; } @@ -180,7 +181,8 @@ bool InstallIconsOperation::performOperation() QString errStr; if (!deleteFileNowOrLater(target, &errStr)) { setError(UserDefinedError); - setErrorString(tr("Failed to overwrite %1: %2").arg(target, errStr)); + setErrorString(tr("Failed to overwrite \"%1\": %2").arg( + QDir::toNativeSeparators(target), errStr)); undoOperation(); return false; } @@ -191,7 +193,8 @@ bool InstallIconsOperation::performOperation() QFile cf(source); if (!cf.copy(target)) { setError(UserDefinedError); - setErrorString(tr("Failed to copy file %1: %2").arg(target, cf.errorString())); + setErrorString(tr("Failed to copy file \"%1\": %2").arg( + QDir::toNativeSeparators(target), cf.errorString())); undoOperation(); return false; } @@ -201,7 +204,8 @@ bool InstallIconsOperation::performOperation() setValue(QLatin1String("files"), files); } else if (fi.isDir() && !QDir(target).exists()) { if (!QDir().mkpath(target)) { - setErrorString(tr("Could not create folder at %1: %2").arg(target, qt_error_string())); + setErrorString(tr("Cannot create directory \"%1\": %2").arg( + QDir::toNativeSeparators(target), qt_error_string())); undoOperation(); return false; } @@ -233,7 +237,7 @@ bool InstallIconsOperation::undoOperation() QFile installedTarget(target); if (installedTarget.exists() && !(installedTarget.copy(source) && installedTarget.remove())) { - warningMessages << QString::fromLatin1("Could not move file from '%1' to '%2', error: %3)").arg( + warningMessages << QString::fromLatin1("Cannot move file from \"%1\" to \"%2\": %3)").arg( target, source, installedTarget.errorString()); } } @@ -249,13 +253,13 @@ bool InstallIconsOperation::undoOperation() deleteFileNowOrLater(target); // then copy the backup onto the target if (!QFile::copy(backup, target)) { - warningMessages << QString::fromLatin1("Could not restore the backup '%1' to '%2'").arg( + warningMessages << QString::fromLatin1("Cannot restore the backup \"%1\" to \"%2\".").arg( backup, target); } // finally remove the backp if (!deleteFileNowOrLater(backup)) - warningMessages << QString::fromLatin1("Could not remove the backup '%1'").arg(backup); + warningMessages << QString::fromLatin1("Cannot remove the backup \"%1\".").arg(backup); } @@ -265,11 +269,11 @@ bool InstallIconsOperation::undoOperation() const QDir dir(*it); removeSystemGeneratedFiles(dir.absolutePath()); if (dir.exists() && !QDir::root().rmdir(dir.path())) - warningMessages << QString::fromLatin1("Could not remove directory '%1'").arg(dir.path()); + warningMessages << QString::fromLatin1("Cannot remove directory \"%1\".").arg(dir.path()); } if (!warningMessages.isEmpty()) { - qWarning() << QString::fromLatin1("Undo of operation '%1' with arguments '%2' had some problems.").arg( + qWarning() << QString::fromLatin1("Undo of operation %1 with arguments \"%2\" had some problems.").arg( name(), arguments().join(QLatin1String(", "))); foreach (const QString &message, warningMessages) { qWarning() << message; |