From de5562ff38e8355c0314a6f994629570146645aa Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 6 Dec 2012 21:07:39 +0100 Subject: make stubbed QCoreApplication::translate() resolve %n Change-Id: I36326d0f11e71580977d6589c9810ffa252a0fa7 Reviewed-by: hjk --- src/corelib/kernel/qcoreapplication.cpp | 13 +++++++++++++ src/corelib/kernel/qcoreapplication.h | 7 ------- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 46de52ec9f..d89df92bdb 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1781,6 +1781,19 @@ bool QCoreApplicationPrivate::isTranslatorInstalled(QTranslator *translator) && QCoreApplication::self->d_func()->translators.contains(translator); } +#else + +QString QCoreApplication::translate(const char *context, const char *sourceText, + const char *disambiguation, int n) +{ + Q_UNUSED(context) + Q_UNUSED(disambiguation) + QString ret = QString::fromUtf8(sourceText); + if (n >= 0) + ret.replace(QLatin1String("%n"), QString::number(n)); + return ret; +} + #endif //QT_NO_TRANSLATE /*! diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index 5f87820823..9f9a1c14fd 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -208,13 +208,6 @@ inline bool QCoreApplication::sendEvent(QObject *receiver, QEvent *event) inline bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event) { if (event) event->spont = true; return self ? self->notifyInternal(receiver, event) : false; } -#ifdef QT_NO_TRANSLATION -inline QString QCoreApplication::translate(const char *, const char *sourceText, const char *, int) -{ - return QString::fromUtf8(sourceText); -} -#endif - #ifdef QT_NO_DEPRECATED # define QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context) #else -- cgit v1.2.3