summaryrefslogtreecommitdiffstats
path: root/examples/declarative/i18n
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-05-05 07:44:27 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-05-05 07:44:27 (GMT)
commit1383f287137c50c7e58e7f9395f7a9ffd9441852 (patch)
tree25f8a9960cb58132bbf42af688cc44b1569809b1 /examples/declarative/i18n
parent238ed995be8f32e815ffb6883144d0547355a8eb (diff)
parent89b4f1eb2bae2f09a9db8094db91a7dabdcdb0a3 (diff)
downloadQt-1383f287137c50c7e58e7f9395f7a9ffd9441852.zip
Qt-1383f287137c50c7e58e7f9395f7a9ffd9441852.tar.gz
Qt-1383f287137c50c7e58e7f9395f7a9ffd9441852.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'examples/declarative/i18n')
-rw-r--r--examples/declarative/i18n/i18n.qml33
-rw-r--r--examples/declarative/i18n/i18n/base.ts12
-rw-r--r--examples/declarative/i18n/i18n/qml_en_AU.qmbin0 -> 81 bytes
-rw-r--r--examples/declarative/i18n/i18n/qml_en_AU.ts12
-rw-r--r--examples/declarative/i18n/i18n/qml_fr.qmbin0 -> 85 bytes
-rw-r--r--examples/declarative/i18n/i18n/qml_fr.ts12
6 files changed, 69 insertions, 0 deletions
diff --git a/examples/declarative/i18n/i18n.qml b/examples/declarative/i18n/i18n.qml
new file mode 100644
index 0000000..3b1279a
--- /dev/null
+++ b/examples/declarative/i18n/i18n.qml
@@ -0,0 +1,33 @@
+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/*.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
+//
+// Translations for new languages are created by copying i18n/base.ts to i18n/qml_<lang>.ts
+// and editing the result with Linguist.
+//
+
+Column {
+ Text {
+ text: "If a translation is available for the system language (eg. Franch) then the string below will translated (eg. 'Bonjour'). Otherwise is will show 'Hello'."
+ width: 200
+ wrapMode: Text.WordWrap
+ }
+ Text {
+ text: qsTr("Hello")
+ font.pointSize: 25
+ }
+}
diff --git a/examples/declarative/i18n/i18n/base.ts b/examples/declarative/i18n/i18n/base.ts
new file mode 100644
index 0000000..82547a1
--- /dev/null
+++ b/examples/declarative/i18n/i18n/base.ts
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" sourcelanguage="en">
+<context>
+ <name>i18n</name>
+ <message>
+ <location filename="../i18n.qml" line="30"/>
+ <source>Hello</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/examples/declarative/i18n/i18n/qml_en_AU.qm b/examples/declarative/i18n/i18n/qml_en_AU.qm
new file mode 100644
index 0000000..fb8b710
--- /dev/null
+++ b/examples/declarative/i18n/i18n/qml_en_AU.qm
Binary files differ
diff --git a/examples/declarative/i18n/i18n/qml_en_AU.ts b/examples/declarative/i18n/i18n/qml_en_AU.ts
new file mode 100644
index 0000000..e991aff
--- /dev/null
+++ b/examples/declarative/i18n/i18n/qml_en_AU.ts
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_AU" sourcelanguage="en">
+<context>
+ <name>i18n</name>
+ <message>
+ <location filename="../i18n.qml" line="30"/>
+ <source>Hello</source>
+ <translation>G&apos;day</translation>
+ </message>
+</context>
+</TS>
diff --git a/examples/declarative/i18n/i18n/qml_fr.qm b/examples/declarative/i18n/i18n/qml_fr.qm
new file mode 100644
index 0000000..583562e
--- /dev/null
+++ b/examples/declarative/i18n/i18n/qml_fr.qm
Binary files differ
diff --git a/examples/declarative/i18n/i18n/qml_fr.ts b/examples/declarative/i18n/i18n/qml_fr.ts
new file mode 100644
index 0000000..365abd9
--- /dev/null
+++ b/examples/declarative/i18n/i18n/qml_fr.ts
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr" sourcelanguage="en">
+<context>
+ <name>i18n</name>
+ <message>
+ <location filename="../i18n.qml" line="30"/>
+ <source>Hello</source>
+ <translation>Bonjour</translation>
+ </message>
+</context>
+</TS>