"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>
This commit is contained in:
Oswald Buddenhagen 2011-09-19 20:26:25 +02:00 committed by Qt by Nokia
parent 37845c730d
commit 187ee8842b
2 changed files with 5 additions and 2 deletions

3
dist/changes-5.0.0 vendored
View File

@ -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 *
****************************************************************************

View File

@ -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