summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp14
-rw-r--r--src/corelib/global/qglobal.cpp20
-rw-r--r--src/corelib/global/qglobal.h1
3 files changed, 35 insertions, 0 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp
index 55ce52a2e7..4d43226df9 100644
--- a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp
@@ -512,6 +512,20 @@ void TheClass::addLabels()
}
//! [qttrid_noop]
+//! [qttrid_n_noop]
+static const char * const ids[] = {
+ //% "%n foo(s) found."
+ QT_TRID_N_NOOP("qtn_foo"),
+ //% "%n bar(s) found."
+ QT_TRID_N_NOOP("qtn_bar"),
+ 0
+};
+
+QString result(int type, int n)
+{
+ return qtTrId(ids[type], n);
+}
+//! [qttrid_n_noop]
//! [37]
qWarning("%s: %s", qUtf8Printable(key), qUtf8Printable(value));
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index c8f97c7148..45dfe21842 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -4061,6 +4061,26 @@ bool qunsetenv(const char *varName)
*/
/*!
+ \macro QT_TRID_N_NOOP(id)
+ \relates <QtGlobal>
+ \since 6.3
+
+ \brief The QT_TRID_N_NOOP macro marks an id for numerator
+ dependent dynamic translation.
+
+ The only purpose of this macro is to provide an anchor for attaching
+ meta data like to qtTrId().
+
+ The macro expands to \a id.
+
+ Example:
+
+ \snippet code/src_corelib_global_qglobal.cpp qttrid_n_noop
+
+ \sa qtTrId(), {Internationalization with Qt}
+*/
+
+/*!
\macro Q_LIKELY(expr)
\relates <QtGlobal>
\since 4.8
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 9d78b4e130..1a3f3d6482 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1358,6 +1358,7 @@ template <typename Ptr> inline auto qGetPtrHelper(Ptr &ptr) noexcept -> decltype
Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1);
#define QT_TRID_NOOP(id) id
+#define QT_TRID_N_NOOP(id) id
#endif // QT_NO_TRANSLATION