summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-09-19 20:26:25 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-26 18:20:05 +0200
commit187ee8842b22fe71feb8677551029f660d0775b9 (patch)
treec24576494d37f1a95a6fed6e835d2c49b7d54dc4
parent37845c730d0a3462a4a7703d63a72f6aaab113bd (diff)
"empty translation" does not mean "no translation"
this makes QCoreApplication::translate() consistent with QTranslator::translate(), and is semantically cleaner. users wishing to shrink their QM files can do that properly by using lrelease -removeidentical. Change-Id: I2b367314cfb985c3d130c7c6347e2742311f497a Reviewed-on: http://codereview.qt-project.org/5165 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: hjk <qthjk@ovi.com>
-rw-r--r--dist/changes-5.0.03
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp4
2 files changed, 5 insertions, 2 deletions
diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0
index 4b05a86d71..ca63359b54 100644
--- a/dist/changes-5.0.0
+++ b/dist/changes-5.0.0
@@ -28,6 +28,9 @@ information about a particular change.
preprocessor #define has also been removed. The build-key is obsolete
and is no longer necessary.
+- QCoreApplication::translate() will no longer return the source text when
+ the translation is empty. Use lrelease -removeidentical for optimization.
+
****************************************************************************
* General *
****************************************************************************
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index d7fb9d3270..9acf1f22c3 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1823,12 +1823,12 @@ QString QCoreApplication::translate(const char *context, const char *sourceText,
for (it = self->d_func()->translators.constBegin(); it != self->d_func()->translators.constEnd(); ++it) {
translationFile = *it;
result = translationFile->translate(context, sourceText, disambiguation, n);
- if (!result.isEmpty())
+ if (!result.isNull())
break;
}
}
- if (result.isEmpty()) {
+ if (result.isNull()) {
#ifdef QT_NO_TEXTCODEC
Q_UNUSED(encoding)
#else