diff options
author | Jerome Pasion <jerome.pasion@digia.com> | 2013-08-12 15:24:03 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-13 14:52:27 +0200 |
commit | f0e285381800c0809e5bfd3a4871a2283ea10fb9 (patch) | |
tree | 0f3718937db9bd89a335b29029abcc8c73785a8f /examples/qml/qml-i18n | |
parent | 65aaea88d9ad2d01f39e76b9ccae0930e67aef9f (diff) |
Doc: Renamed and moved examples/qml/i18n to examples/qml/qml-i18n
-the generated HTML page conflicts with the i18n.html page from qtdoc.
-edited the content.
Task-number: QTBUG-32580
Change-Id: I32ded1913d9faecb95e28043983e957ccd0e8749
Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'examples/qml/qml-i18n')
-rw-r--r-- | examples/qml/qml-i18n/doc/images/qml-i18n-example.png | bin | 0 -> 1945 bytes | |||
-rw-r--r-- | examples/qml/qml-i18n/doc/src/i18n.qdoc | 55 | ||||
-rw-r--r-- | examples/qml/qml-i18n/i18n/base.ts | 12 | ||||
-rw-r--r-- | examples/qml/qml-i18n/i18n/qml_en_AU.ts | 12 | ||||
-rw-r--r-- | examples/qml/qml-i18n/i18n/qml_fr.ts | 12 | ||||
-rw-r--r-- | examples/qml/qml-i18n/qml-i18n.qml | 60 | ||||
-rw-r--r-- | examples/qml/qml-i18n/qml-i18n.qmlproject | 16 |
7 files changed, 167 insertions, 0 deletions
diff --git a/examples/qml/qml-i18n/doc/images/qml-i18n-example.png b/examples/qml/qml-i18n/doc/images/qml-i18n-example.png Binary files differnew file mode 100644 index 0000000000..02f645e702 --- /dev/null +++ b/examples/qml/qml-i18n/doc/images/qml-i18n-example.png diff --git a/examples/qml/qml-i18n/doc/src/i18n.qdoc b/examples/qml/qml-i18n/doc/src/i18n.qdoc new file mode 100644 index 0000000000..5a61906497 --- /dev/null +++ b/examples/qml/qml-i18n/doc/src/i18n.qdoc @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! + \title QML Examples - Internationalization + \example qml-i18n + \image qml-i18n-example.png + \brief This is an internationalization example + + 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 or updated by running: + +\code + lupdate qml-i18n.qml -ts i18n/base.ts +\endcode + + Translations for new languages are created by copying \e i18n/base.ts to \e i18n/qml_<lang>.ts + The .ts files can then be edited with \l {Qt Linguist}: + +\code + linguist i18n/qml_fr.ts +\endcode + + The run-time translation files are then generated by running: + +\code + lrelease i18n/*.ts +\endcode + +*/ diff --git a/examples/qml/qml-i18n/i18n/base.ts b/examples/qml/qml-i18n/i18n/base.ts new file mode 100644 index 0000000000..07e00f3ad2 --- /dev/null +++ b/examples/qml/qml-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>qml-i18n</name> + <message> + <location filename="../qml-i18n.qml" line="56"/> + <source>Hello</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/examples/qml/qml-i18n/i18n/qml_en_AU.ts b/examples/qml/qml-i18n/i18n/qml_en_AU.ts new file mode 100644 index 0000000000..e991affe7f --- /dev/null +++ b/examples/qml/qml-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'day</translation> + </message> +</context> +</TS> diff --git a/examples/qml/qml-i18n/i18n/qml_fr.ts b/examples/qml/qml-i18n/i18n/qml_fr.ts new file mode 100644 index 0000000000..1784914f42 --- /dev/null +++ b/examples/qml/qml-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="../qml-i18n.qml" line="30"/> + <source>Hello</source> + <translation>Bonjour</translation> + </message> +</context> +</TS> diff --git a/examples/qml/qml-i18n/qml-i18n.qml b/examples/qml/qml-i18n/qml-i18n.qml new file mode 100644 index 0000000000..00fc310a6c --- /dev/null +++ b/examples/qml/qml-i18n/qml-i18n.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + width: 640; height: 480 + + 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 it will show 'Hello'." + width: parent.width; wrapMode: Text.WordWrap + } + + Text { + text: qsTr("Hello") + font.pointSize: 25; anchors.horizontalCenter: parent.horizontalCenter + } + } +} diff --git a/examples/qml/qml-i18n/qml-i18n.qmlproject b/examples/qml/qml-i18n/qml-i18n.qmlproject new file mode 100644 index 0000000000..a1a56c2bb2 --- /dev/null +++ b/examples/qml/qml-i18n/qml-i18n.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "qml-i18n.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} |