summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobal.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-07-03 11:28:16 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-07-06 11:54:42 (GMT)
commit20d73ef1bf23569b09ca862f6c5e5971098613d6 (patch)
tree88f3aa79ab7827281b3e244ad18c10397f3e2f72 /src/corelib/global/qglobal.cpp
parente446729d99bebaf7fac0110fcf22fc867d7229cb (diff)
downloadQt-20d73ef1bf23569b09ca862f6c5e5971098613d6.zip
Qt-20d73ef1bf23569b09ca862f6c5e5971098613d6.tar.gz
Qt-20d73ef1bf23569b09ca862f6c5e5971098613d6.tar.bz2
support for id-based translations
unlike in an earlier attempt, ids are textual this time. the developer is able to provide a template for the string. when lupdate and lrelease are integrated into the build process, this makes it possible to avoid a round-trip to a dedicated string designer during the early development stage. Requirement-id: QT-435
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
-rw-r--r--src/corelib/global/qglobal.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index f7a97e1..ad4868d 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2459,6 +2459,62 @@ int qrand()
*/
/*!
+ \fn QString qtTrId(const char *id, int n = -1)
+ \relates <QtGlobal>
+ \reentrant
+ \since 4.6
+
+ Returns a translated string identified by \a id.
+ If no matching string is found, the id itself is returned. This
+ should not happen under normal conditions.
+
+ If \a n >= 0, all occurrences of \c %n in the resulting string
+ are replaced with a decimal representation of \a n. In addition,
+ depending on \a n's value, the translation text may vary.
+
+ Meta data and comments can be passed as documented for QObject::tr().
+ In addition, it is possible to supply a source string template like that:
+
+ \tt{//% <C string>}
+
+ or
+
+ \tt{\begincomment% <C string> \endcomment}
+
+ Example:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp qttrid
+
+ Creating QM files suitable for use with this function requires passing
+ the \c -idbased option to the \c lrelease tool.
+
+ \warning This method is reentrant only if all translators are
+ installed \e before calling this method. Installing or removing
+ translators while performing translations is not supported. Doing
+ so will probably result in crashes or other undesirable behavior.
+
+ \sa QObject::tr(), QCoreApplication::translate(), {Internationalization with Qt}
+*/
+
+/*!
+ \macro QT_TRID_NOOP(id)
+ \relates <QtGlobal>
+ \since 4.6
+
+ Marks \a id for 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 doc/src/snippets/code/src_corelib_global_qglobal.cpp qttrid_noop
+
+ \sa qtTrId(), {Internationalization with Qt}
+*/
+
+/*!
\macro QT_POINTER_SIZE
\relates <QtGlobal>