summaryrefslogtreecommitdiffstats
path: root/tools/devtool
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@theqtcompany.com>2015-06-24 10:15:16 +0200
committerKai Koehne <kai.koehne@theqtcompany.com>2015-06-24 09:22:42 +0000
commit1e589e37a991b29076e9a661f92dfa178421c208 (patch)
treeccdae70edb75b1bc17f0efc61086e16554e3f4eb /tools/devtool
parent65a5d4d33c7dcb27ce99ce59535733a28991c544 (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 'tools/devtool')
-rw-r--r--tools/devtool/binarydump.cpp18
-rw-r--r--tools/devtool/binaryreplace.cpp22
-rw-r--r--tools/devtool/main.cpp12
3 files changed, 26 insertions, 26 deletions
diff --git a/tools/devtool/binarydump.cpp b/tools/devtool/binarydump.cpp
index a0ff4f74e..f8bb23996 100644
--- a/tools/devtool/binarydump.cpp
+++ b/tools/devtool/binarydump.cpp
@@ -48,14 +48,14 @@ int BinaryDump::dump(const QInstaller::ResourceCollectionManager &manager, const
QDir targetDir(QFileInfo(target).absoluteFilePath());
if (targetDir.exists()) {
if (!targetDir.entryList(QDir::NoDotAndDotDot | QDir::AllEntries).isEmpty()) {
- std::cerr << qPrintable(QString::fromLatin1("Target directory '%1' already exists and "
- "is not empty.").arg(targetDir.path())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Target directory \"%1\" already exists and "
+ "is not empty.").arg(QDir::toNativeSeparators(targetDir.path()))) << std::endl;
return EXIT_FAILURE;
}
} else {
if (!QDir().mkpath(targetDir.path())) {
- std::cerr << qPrintable(QString::fromLatin1("Could not create '%1'.").arg(targetDir
- .path())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Cannot create \"%1\".").arg(
+ QDir::toNativeSeparators(targetDir.path()))) << std::endl;
return EXIT_FAILURE;
}
}
@@ -69,8 +69,8 @@ int BinaryDump::dump(const QInstaller::ResourceCollectionManager &manager, const
}
if (!targetDir.cd(QLatin1String("metadata"))) {
- std::cerr << qPrintable(QString::fromLatin1("Could not switch to '%1/metadata'.")
- .arg(targetDir.path())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Cannot switch to \"%1/metadata\".")
+ .arg(QDir::toNativeSeparators(targetDir.path()))) << std::endl;
return EXIT_FAILURE;
}
@@ -82,8 +82,8 @@ int BinaryDump::dump(const QInstaller::ResourceCollectionManager &manager, const
QString error;
QDomDocument doc;
if (!doc.setContent(&updatesXml, &error)) {
- throw QInstaller::Error(QString::fromLatin1("Could not read: '%1'. %2").arg(updatesXml
- .fileName(), error));
+ throw QInstaller::Error(QString::fromLatin1("Cannot read: \"%1\": %2").arg(
+ QDir::toNativeSeparators(updatesXml.fileName()), error));
}
QHash<QString, QString> versionMap;
@@ -114,7 +114,7 @@ int BinaryDump::dump(const QInstaller::ResourceCollectionManager &manager, const
continue;
if (!targetDir.mkpath(name)) {
- throw QInstaller::Error(QString::fromLatin1("Could not create target dir: %1.")
+ throw QInstaller::Error(QString::fromLatin1("Cannot create target dir: %1.")
.arg(targetDir.filePath(name)));
}
diff --git a/tools/devtool/binaryreplace.cpp b/tools/devtool/binaryreplace.cpp
index 3e6144e39..b62ad58de 100644
--- a/tools/devtool/binaryreplace.cpp
+++ b/tools/devtool/binaryreplace.cpp
@@ -84,19 +84,19 @@ int BinaryReplace::replace(const QString &source, const QString &target)
.path;
result = EXIT_SUCCESS;
} catch (const Lib7z::SevenZipException& e) {
- std::cerr << qPrintable(QString::fromLatin1("Error while extracting '%1': %2.")
- .arg(newInstallerBasePath, e.message())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Error while extracting \"%1\": %2")
+ .arg(QDir::toNativeSeparators(newInstallerBasePath), e.message())) << std::endl;
} catch (...) {
std::cerr << qPrintable(QString::fromLatin1("Unknown exception caught while "
- "extracting '%1'.").arg(newInstallerBasePath)) << std::endl;
+ "extracting \"%1\".").arg(QDir::toNativeSeparators(newInstallerBasePath))) << std::endl;
}
} else {
- std::cerr << qPrintable(QString::fromLatin1("Could not open '%1' for reading: %2.")
- .arg(newInstallerBasePath, archive.errorString())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Cannot open \"%1\" for reading: %2")
+ .arg(QDir::toNativeSeparators(newInstallerBasePath), archive.errorString())) << std::endl;
}
if (!archive.remove()) {
- std::cerr << qPrintable(QString::fromLatin1("Could not delete file '%1': %2.")
- .arg(newInstallerBasePath, archive.errorString())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Cannot delete file \"%1\": %2")
+ .arg(QDir::toNativeSeparators(newInstallerBasePath), archive.errorString())) << std::endl;
}
if (result != EXIT_SUCCESS)
return result;
@@ -133,19 +133,19 @@ int BinaryReplace::replace(const QString &source, const QString &target)
#endif
QFile backup(installerBaseOld.fileName() + QLatin1String(".bak"));
if (backup.exists() && (!backup.remove())) {
- std::cerr << qPrintable(QString::fromLatin1("Could not delete '%1'. %2")
- .arg(backup.fileName(), backup.errorString())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Cannot delete \"%1\": %2")
+ .arg(QDir::toNativeSeparators(backup.fileName()), backup.errorString())) << std::endl;
}
const QString oldBasePath = installerBaseOld.fileName();
if (!installerBaseOld.rename(oldBasePath + QLatin1String(".bak"))) {
- std::cerr << qPrintable(QString::fromLatin1("Could not rename '%1' to '%2'. %3")
+ std::cerr << qPrintable(QString::fromLatin1("Cannot rename \"%1\" to \"%2\": %3")
.arg(oldBasePath, oldBasePath + QLatin1String(".bak"),
installerBaseOld.errorString())) << std::endl;
}
if (!installerBaseNew.rename(oldBasePath)) {
- std::cerr << qPrintable(QString::fromLatin1("Could not copy '%1' to '%2'. %3")
+ std::cerr << qPrintable(QString::fromLatin1("Cannot copy \"%1\" to \"%2\": %3")
.arg(installerBaseNew.fileName(), oldBasePath, installerBaseNew.errorString()))
<< std::endl;
} else {
diff --git a/tools/devtool/main.cpp b/tools/devtool/main.cpp
index 638242b29..ff7551fed 100644
--- a/tools/devtool/main.cpp
+++ b/tools/devtool/main.cpp
@@ -61,8 +61,8 @@ struct Command
const char* argDescription;
} Commands[] = {
{ "dump", "Dumps the binary content that belongs to an installer or maintenance tool into "
- "target folder.", 2, "<binary> <targetfolder>", "The <binary> containing the data to "
- "dump.\nThe <targetfolder> to dump the data in."
+ "target directory.", 2, "<binary> <targetdirecory>", "The <binary> containing the data to "
+ "dump.\nThe <targetdirectory> to dump the data in."
},
{ "update", "Updates existing installer or maintenance tool with a new installer base.", 2,
@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
parser.showHelp(EXIT_SUCCESS);
}
}
- return fail(QString::fromLatin1("'%1' is not a devtool command.").arg(command));
+ return fail(QString::fromLatin1("\"%1\" is not a devtool command.").arg(command));
}
QString helpText = parser.helpText();
@@ -164,7 +164,7 @@ int main(int argc, char *argv[])
}
if (!found)
- return fail(QString::fromLatin1("'%1' is not a devtool command.").arg(command));
+ return fail(QString::fromLatin1("\"%1\" is not a devtool command.").arg(command));
QInstaller::init();
QInstaller::setVerbose(parser.isSet(verbose));
@@ -183,7 +183,7 @@ int main(int argc, char *argv[])
QInstaller::openForRead(&tmp);
if (!tmp.seek(QInstaller::BinaryContent::findMagicCookie(&tmp, cookie) - sizeof(qint64)))
- throw QInstaller::Error(QLatin1String("Could not seek to read magic marker."));
+ throw QInstaller::Error(QLatin1String("Cannot seek to read magic marker."));
QInstaller::BinaryLayout layout;
layout.magicMarker = QInstaller::retrieveInt64(&tmp);
@@ -228,7 +228,7 @@ int main(int argc, char *argv[])
const QByteArray ba = resource->readAll();
if (!QResource::registerResource((const uchar*) ba.data(), QLatin1String(":/metadata")))
- throw QInstaller::Error(QLatin1String("Could not register in-binary resource."));
+ throw QInstaller::Error(QLatin1String("Cannot register in-binary resource."));
resourceMappings.append(ba);
if (!isOpen)
resource->close();