diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-07-03 11:28:16 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-07-06 11:54:42 (GMT) |
commit | 20d73ef1bf23569b09ca862f6c5e5971098613d6 (patch) | |
tree | 88f3aa79ab7827281b3e244ad18c10397f3e2f72 /doc/src/snippets | |
parent | e446729d99bebaf7fac0110fcf22fc867d7229cb (diff) | |
download | Qt-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 'doc/src/snippets')
-rw-r--r-- | doc/src/snippets/code/src_corelib_global_qglobal.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_corelib_global_qglobal.cpp b/doc/src/snippets/code/src_corelib_global_qglobal.cpp index 287181a..50052c3 100644 --- a/doc/src/snippets/code/src_corelib_global_qglobal.cpp +++ b/doc/src/snippets/code/src_corelib_global_qglobal.cpp @@ -358,6 +358,30 @@ QString global_greeting(int type) //! [36] +//! [qttrid] + //% "%n fooish bar(s) found.\n" + //% "Do you want to continue?" + QString text = qtTrId("qtn_foo_bar", n); +//! [qttrid] + + +//! [qttrid_noop] +static const char * const ids[] = { + //% "This is the first text." + QT_TRID_NOOP("qtn_1st_text"), + //% "This is the second text." + QT_TRID_NOOP("qtn_2nd_text"), + 0 +}; + +void TheClass::addLabels() +{ + for (int i = 0; ids[i]; ++i) + new QLabel(qtTrId(ids[i]), this); +} +//! [qttrid_noop] + + //! [37] qWarning("%s: %s", qPrintable(key), qPrintable(value)); //! [37] |