summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-06-03 18:05:47 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-06-03 18:16:48 +0200
commit068177288001c46896d6b04c520731adb56ed288 (patch)
treef5588086116c8fa1d3d16bdefc544c6ad4fa5c49
parent482159bddec1736a8854dc2db1b75cf856d00255 (diff)
remove spurious empty lines in the linguist tools' output
ConversionData::error() does already newline-terminate the strings.
-rw-r--r--tools/linguist/lconvert/main.cpp8
-rw-r--r--tools/linguist/lrelease/main.cpp4
-rw-r--r--tools/linguist/shared/po.cpp16
-rw-r--r--tools/linguist/shared/qm.cpp4
-rw-r--r--tools/linguist/shared/translator.cpp2
-rw-r--r--tools/linguist/shared/translator.h2
6 files changed, 18 insertions, 18 deletions
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp
index 049ea43856..094406c984 100644
--- a/tools/linguist/lconvert/main.cpp
+++ b/tools/linguist/lconvert/main.cpp
@@ -240,7 +240,7 @@ int main(int argc, char *argv[])
tr.setLanguageCode(Translator::guessLanguageCodeFromFileName(inFiles[0].name));
if (!tr.load(inFiles[0].name, cd, inFiles[0].format)) {
- std::cerr << qPrintable(cd.error()) << std::endl;
+ std::cerr << qPrintable(cd.error());
return 2;
}
tr.reportDuplicates(tr.resolveDuplicates(), inFiles[0].name, verbose);
@@ -248,7 +248,7 @@ int main(int argc, char *argv[])
for (int i = 1; i < inFiles.size(); ++i) {
Translator tr2;
if (!tr2.load(inFiles[i].name, cd, inFiles[i].format)) {
- std::cerr << qPrintable(cd.error()) << std::endl;
+ std::cerr << qPrintable(cd.error());
return 2;
}
tr2.reportDuplicates(tr2.resolveDuplicates(), inFiles[i].name, verbose);
@@ -273,11 +273,11 @@ int main(int argc, char *argv[])
tr.normalizeTranslations(cd);
if (!cd.errors().isEmpty()) {
- std::cerr << qPrintable(cd.error()) << std::endl;
+ std::cerr << qPrintable(cd.error());
cd.clearErrors();
}
if (!tr.save(outFileName, cd, outFormat)) {
- std::cerr << qPrintable(cd.error()) << std::endl;
+ std::cerr << qPrintable(cd.error());
return 3;
}
return 0;
diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp
index df0b430aae..b5cff90a77 100644
--- a/tools/linguist/lrelease/main.cpp
+++ b/tools/linguist/lrelease/main.cpp
@@ -108,7 +108,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 << "lrelease error: " << qPrintable(cd.error()) << std::endl;
+ std::cerr << "lrelease error: " << qPrintable(cd.error());
} else {
if (!cd.errors().isEmpty())
printOut(cd.error());
@@ -143,7 +143,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName,
if (!ok) {
std::cerr << "lrelease error: cannot save '" << qPrintable(qmFileName)
- << "': " << qPrintable(cd.error()) << std::endl;
+ << "': " << qPrintable(cd.error());
} else if (!cd.errors().isEmpty()) {
printOut(cd.error());
}
diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp
index 6a1d426a98..a6923328ae 100644
--- a/tools/linguist/shared/po.cpp
+++ b/tools/linguist/shared/po.cpp
@@ -461,7 +461,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd)
continue;
int idx = hdr.indexOf(':');
if (idx < 0) {
- cd.appendError(QString::fromLatin1("Unexpected PO header format '%1'\n")
+ cd.appendError(QString::fromLatin1("Unexpected PO header format '%1'")
.arg(QString::fromLatin1(hdr)));
error = true;
break;
@@ -482,7 +482,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd)
} else if (hdrName == "Content-Type") {
if (cd.m_codecForSource.isEmpty()) {
if (!hdrValue.startsWith("text/plain; charset=")) {
- cd.appendError(QString::fromLatin1("Unexpected Content-Type header '%1'\n")
+ cd.appendError(QString::fromLatin1("Unexpected Content-Type header '%1'")
.arg(QString::fromLatin1(hdrValue)));
error = true;
// This will avoid a flood of conversion errors.
@@ -491,7 +491,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd)
QByteArray cod = hdrValue.mid(20);
QTextCodec *cdc = QTextCodec::codecForName(cod);
if (!cdc) {
- cd.appendError(QString::fromLatin1("Unsupported codec '%1'\n")
+ cd.appendError(QString::fromLatin1("Unsupported codec '%1'")
.arg(QString::fromLatin1(cod)));
error = true;
// This will avoid a flood of conversion errors.
@@ -503,7 +503,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd)
}
} else if (hdrName == "Content-Transfer-Encoding") {
if (hdrValue != "8bit") {
- cd.appendError(QString::fromLatin1("Unexpected Content-Transfer-Encoding '%1'\n")
+ cd.appendError(QString::fromLatin1("Unexpected Content-Transfer-Encoding '%1'")
.arg(QString::fromLatin1(hdrValue)));
return false;
}
@@ -644,7 +644,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd)
if (qtContexts)
splitContext(&item.oldTscomment, &item.context);
} else {
- cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n"))
+ cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'"))
.arg(l + 1).arg(codec->toUnicode(lines[l])));
error = true;
}
@@ -661,13 +661,13 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd)
} else if (line.startsWith("#~ msgctxt ")) {
item.tscomment = slurpEscapedString(lines, l, 11, "#~ ", cd);
} else {
- cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n"))
+ cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'"))
.arg(l + 1).arg(codec->toUnicode(lines[l])));
error = true;
}
break;
default:
- cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n"))
+ cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'"))
.arg(l + 1).arg(codec->toUnicode(lines[l])));
error = true;
break;
@@ -685,7 +685,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd)
item.extra[QLatin1String("po-msgid_plural")] = codec->toUnicode(extra);
item.isPlural = true;
} else {
- cd.appendError(QString(QLatin1String("PO-format error in line %1: '%2'\n"))
+ cd.appendError(QString(QLatin1String("PO-format error in line %1: '%2'"))
.arg(l + 1).arg(codec->toUnicode(lines[l])));
error = true;
}
diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp
index e2c4f4acef..66789432e1 100644
--- a/tools/linguist/shared/qm.cpp
+++ b/tools/linguist/shared/qm.cpp
@@ -773,11 +773,11 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData
if (saved && cd.isVerbose()) {
int generatedCount = finished + unfinished;
cd.appendError(QCoreApplication::translate("LRelease",
- " Generated %n translation(s) (%1 finished and %2 unfinished)\n", 0,
+ " Generated %n translation(s) (%1 finished and %2 unfinished)", 0,
QCoreApplication::CodecForTr, generatedCount).arg(finished).arg(unfinished));
if (untranslated)
cd.appendError(QCoreApplication::translate("LRelease",
- " Ignored %n untranslated source text(s)\n", 0,
+ " Ignored %n untranslated source text(s)", 0,
QCoreApplication::CodecForTr, untranslated));
}
return saved;
diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp
index 8223dc62a8..36af8dae90 100644
--- a/tools/linguist/shared/translator.cpp
+++ b/tools/linguist/shared/translator.cpp
@@ -689,7 +689,7 @@ void Translator::normalizeTranslations(ConversionData &cd)
cd.appendError(QLatin1String(
"Removed plural forms as the target language has less "
"forms.\nIf this sounds wrong, possibly the target language is "
- "not set or recognized.\n"));
+ "not set or recognized."));
}
QString Translator::guessLanguageCodeFromFileName(const QString &filename)
diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h
index bb199f086e..cfb2178425 100644
--- a/tools/linguist/shared/translator.h
+++ b/tools/linguist/shared/translator.h
@@ -92,7 +92,7 @@ public:
bool sortContexts() const { return m_sortContexts; }
void appendError(const QString &error) { m_errors.append(error); }
- QString error() const { return m_errors.join(QLatin1String("\n")); }
+ QString error() const { return m_errors.isEmpty() ? QString() : m_errors.join(QLatin1String("\n")) + QLatin1Char('\n'); }
QStringList errors() const { return m_errors; }
void clearErrors() { m_errors.clear(); }