summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 049ea43..094406c 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 df0b430..b5cff90 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 6a1d426..a692332 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 e2c4f4a..6678943 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 8223dc6..36af8da 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 bb199f0..cfb2178 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(); }