merge translate() overloads
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Mon, 19 Sep 2011 18:18:08 +0000 (20:18 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 21 Sep 2011 10:07:19 +0000 (12:07 +0200)
Change-Id: I58f0d2c2ec6da751860a90096c49c662658643c1
Reviewed-on: http://codereview.qt-project.org/5164
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Reviewed-by: hjk <qthjk@ovi.com>
src/corelib/kernel/qtranslator.cpp
src/corelib/kernel/qtranslator.h

index 1b3e06d..6a3a463 100644 (file)
@@ -907,41 +907,24 @@ void QTranslatorPrivate::clear()
 }
 
 /*!
-    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);
 }
 
index 0a9bbde..43cd63d 100644 (file)
@@ -63,11 +63,8 @@ public:
     explicit QTranslator(QObject *parent = 0);
     ~QTranslator();
 
-    // ### Qt 5: Merge (with "int n = -1")
     virtual QString translate(const char *context, const char *sourceText,
-                              const char *disambiguation = 0) const;
-    QString translate(const char *context, const char *sourceText, const char *disambiguation,
-                      int n) const;
+                              const char *disambiguation = 0, int n = -1) const;
 
     virtual bool isEmpty() const;