From 91d2ee5e09a6b48cd1133c727cd02945f29ea994 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 19 Sep 2011 20:18:08 +0200 Subject: merge translate() overloads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I58f0d2c2ec6da751860a90096c49c662658643c1 Reviewed-on: http://codereview.qt-project.org/5164 Reviewed-by: Qt Sanity Bot Reviewed-by: Jan-Arve Sæther Reviewed-by: hjk --- src/corelib/kernel/qtranslator.cpp | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) (limited to 'src/corelib/kernel/qtranslator.cpp') diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 1b3e06dd69..6a3a463f6b 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -906,42 +906,25 @@ void QTranslatorPrivate::clear() new QEvent(QEvent::LanguageChange)); } -/*! - Returns the translation for the key (\a context, \a sourceText, - \a disambiguation). If none is found, also tries (\a context, \a - sourceText, ""). If that still fails, returns an empty string. - - If you need to programatically insert translations in to a - QTranslator, this function can be reimplemented. - - \sa load() -*/ -QString QTranslator::translate(const char *context, const char *sourceText, const char *disambiguation) const -{ - Q_D(const QTranslator); - return d->do_translate(context, sourceText, disambiguation, -1); -} - - /*! \overload translate() Returns the translation for the key (\a context, \a sourceText, \a disambiguation). If none is found, also tries (\a context, \a - sourceText, ""). If that still fails, returns an empty string. + sourceText, ""). If that still fails, returns a null string. If \a n is not -1, it is used to choose an appropriate form for the translation (e.g. "%n file found" vs. "%n files found"). + If you need to programatically insert translations into a + QTranslator, this function can be reimplemented. + \sa load() */ QString QTranslator::translate(const char *context, const char *sourceText, const char *disambiguation, int n) const { Q_D(const QTranslator); - // this step is necessary because the 3-parameter translate() overload is virtual - if (n == -1) - return translate(context, sourceText, disambiguation); return d->do_translate(context, sourceText, disambiguation, n); } -- cgit v1.2.3