Commit 41180d80 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen Committed by Qt by Nokia
Browse files

use a printErr() function instead of std::cerr like in lupdate

(cherry picked from commit 0b92d6cc61a18ae18d254ac6ee463e74cb570db4)

Change-Id: I14834ad295109a979dd5e3e41b814543c68f3d35
Reviewed-on: http://codereview.qt-project.org/4603


Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@nokia.com>
parent 12b7b521
Branches
Tags
No related merge requests found
Showing with 12 additions and 8 deletions
......@@ -56,8 +56,6 @@
#include <QtCore/QTextStream>
#include <QtCore/QLibraryInfo>
#include <iostream>
QT_USE_NAMESPACE
#ifdef QT_BOOTSTRAPPED
......@@ -85,6 +83,12 @@ static void printOut(const QString & out)
stream << out;
}
static void printErr(const QString & out)
{
QTextStream stream(stderr);
stream << out;
}
static void printUsage()
{
printOut(LR::tr(
......@@ -120,7 +124,7 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo
ConversionData cd;
bool ok = tor.load(tsFileName, cd, QLatin1String("auto"));
if (!ok) {
std::cerr << qPrintable(LR::tr("lrelease error: %1").arg(cd.error()));
printErr(LR::tr("lrelease error: %1").arg(cd.error()));
} else {
if (!cd.errors().isEmpty())
printOut(cd.error());
......@@ -144,7 +148,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName,
QFile file(qmFileName);
if (!file.open(QIODevice::WriteOnly)) {
std::cerr << qPrintable(LR::tr("lrelease error: cannot create '%1': %2\n")
printErr(LR::tr("lrelease error: cannot create '%1': %2\n")
.arg(qmFileName, file.errorString()));
return false;
}
......@@ -154,7 +158,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName,
file.close();
if (!ok) {
std::cerr << qPrintable(LR::tr("lrelease error: cannot save '%1': %2")
printErr(LR::tr("lrelease error: cannot save '%1': %2")
.arg(qmFileName, cd.error()));
} else if (!cd.errors().isEmpty()) {
printOut(cd.error());
......@@ -275,13 +279,13 @@ int main(int argc, char **argv)
visitor.setVerbose(cd.isVerbose());
if (!visitor.queryProFile(&pro)) {
std::cerr << qPrintable(LR::tr(
printErr(LR::tr(
"lrelease error: cannot read project file '%1'.\n")
.arg(inputFile));
continue;
}
if (!visitor.accept(&pro)) {
std::cerr << qPrintable(LR::tr(
printErr(LR::tr(
"lrelease error: cannot process project file '%1'.\n")
.arg(inputFile));
continue;
......@@ -289,7 +293,7 @@ int main(int argc, char **argv)
QStringList translations = visitor.values(QLatin1String("TRANSLATIONS"));
if (translations.isEmpty()) {
std::cerr << qPrintable(LR::tr(
printErr(LR::tr(
"lrelease warning: Met no 'TRANSLATIONS' entry in project file '%1'\n")
.arg(inputFile));
} else {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment