diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-12-09 01:31:46 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-12-09 01:31:46 (GMT) |
commit | bf50114e0a039102b37f7f7a50def33b2275b3b3 (patch) | |
tree | f0b8a3695cee8bf255de08909e8f5fa211b5de98 /doc/src | |
parent | 31156004ac128a3d35870e3cc8b198515fa7b4d9 (diff) | |
parent | 81e855944cecbd0a37bd04c899d71add97a15a65 (diff) | |
download | Qt-bf50114e0a039102b37f7f7a50def33b2275b3b3.zip Qt-bf50114e0a039102b37f7f7a50def33b2275b3b3.tar.gz Qt-bf50114e0a039102b37f7f7a50def33b2275b3b3.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/declarative/qmli18n.qdoc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/src/declarative/qmli18n.qdoc b/doc/src/declarative/qmli18n.qdoc index 4b62fcb..0c8b1d1 100644 --- a/doc/src/declarative/qmli18n.qdoc +++ b/doc/src/declarative/qmli18n.qdoc @@ -43,6 +43,8 @@ \page qmli18n.html \title QML Internationalization +\section1 Overview + Strings in QML can be marked for translation using the qsTr(), qsTranslate(), QT_TR_NOOP(), and QT_TRANSLATE_NOOP() functions. @@ -63,4 +65,31 @@ capabilities are described more fully in: You can test a translation in \l {qmlviewer} using the -translation option. +\section1 Example + +First we create a simple QML file with text to be translated. The string +that needs to be translated is enclosed in a call to \c qsTr(). + +hello.qml: +\qml +import Qt 4.6 + +Rectangle { + width: 200; height: 200 + Text { text: qsTr("Hello"); anchors.centerIn: parent } +} +\endqml + +Next we create a translation source file using lupdate: +\code +lupdate hello.qml -ts hello.ts +\endcode + +Then we open \c hello.ts in \l {Linguist}, provide a translation +and create the release file \c hello.qm. + +Finally, we can test the translation in qmlviewer: +\code +qmlviewer -translation hello.qm hello.qml +\endcode */ |