root@slitaz:~# ls -R /usr/local/Trolltech/Qt-4.7.0/examples/declarative/i18n
/usr/local/Trolltech/Qt-4.7.0/examples/declarative/i18n:
i18n i18n.qmlproject.user snapshot1-zh.png
i18n.qml snapshot1-en.png
i18n.qmlproject snapshot1-fr.png
/usr/local/Trolltech/Qt-4.7.0/examples/declarative/i18n/i18n:
base.ts qml_en_AU.ts qml_fr.ts qml_zh.ts
qml_en_AU.qm qml_fr.qm qml_zh.qm
root@slitaz:~# cat /usr/local/Trolltech/Qt-4.7.0/examples/declarative/i18n/i
18n/qml_zh.ts
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="zh" sourcelanguage="en">
<context>
<name>i18n</name>
<message>
<location filename="../i18n.qml" line="30"/>
<source>Hello</source>
<translation>哈囉</translation>
</message>
</context>
</TS>
i18n.qml
import Qt 4.7
//
// The QML runtime automatically loads a translation from the i18n subdirectory of the root
// QML file, based on the system language.
//
// The files are created/updated by running:
//
// lupdate i18n.qml -ts i18n/base.ts
//
// Translations for new languages are created by copying i18n/base.ts to i18n/qml_<lang>.ts
// The .ts files can then be edited with Linguist:
//
// linguist i18n/qml_fr.ts
//
// The run-time translation files are then generaeted by running:
//
// lrelease i18n/*.ts
//
Rectangle {
//width: 640; height: 480
width: 480; height: 240
Column {
anchors.fill: parent; spacing: 20
Text {
text: "If a translation is available for the system language (eg. French) then the string below will translated (eg. 'Bonjour'). Otherwise is will show 'Hello'."
width: parent.width; wrapMode: Text.WordWrap
}
Text {
text: qsTr("Hello")
font.pointSize: 25; anchors.horizontalCenter: parent.horizontalCenter
}
}
}