diff options
author | Niels Weber <niels.weber@digia.com> | 2015-01-29 12:29:09 +0100 |
---|---|---|
committer | Niels Weber <niels.weber@theqtcompany.com> | 2015-02-09 10:06:46 +0000 |
commit | 52ebff797da4a29f61459fd6d183d2e07498c591 (patch) | |
tree | afe58065d5ad36faee01a9f5268c57fa006e9a3e /examples/translations/packages | |
parent | 04dcfb68cb7e2c3995f0b66b1bbd926b1864819b (diff) |
Add a translation example
Add an example showing how the translation of components
works. Also document this.
Make translated license files work again.
Task-number: QTIFW-469
Change-Id: I3c13ecc9941b09370d0713b19b2683b42454c43c
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Diffstat (limited to 'examples/translations/packages')
9 files changed, 181 insertions, 0 deletions
diff --git a/examples/translations/packages/com.vendor.product/data/installcontent.txt b/examples/translations/packages/com.vendor.product/data/installcontent.txt new file mode 100644 index 000000000..f40001983 --- /dev/null +++ b/examples/translations/packages/com.vendor.product/data/installcontent.txt @@ -0,0 +1,2 @@ +This file will be installed into the target directory.... + diff --git a/examples/translations/packages/com.vendor.product/meta/de.ts b/examples/translations/packages/com.vendor.product/meta/de.ts new file mode 100644 index 000000000..dd6000354 --- /dev/null +++ b/examples/translations/packages/com.vendor.product/meta/de.ts @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="de_DE"> +<context> + <name>Page</name> + <message> + <source>Translations Example</source> + <translation>Beispiel für Übersetzungen</translation> + </message> + <message> + <source>This is some text.</source> + <translation>Dies ist ein Text.</translation> + </message> +</context> +<context> + <name>installscript</name> + <message> + <source>This is a dynamically created page.</source> + <translation>Diese Seite wurde dynamisch erzeugt.</translation> + </message> +</context> +</TS> diff --git a/examples/translations/packages/com.vendor.product/meta/installscript.qs b/examples/translations/packages/com.vendor.product/meta/installscript.qs new file mode 100644 index 000000000..cb4db4cd5 --- /dev/null +++ b/examples/translations/packages/com.vendor.product/meta/installscript.qs @@ -0,0 +1,66 @@ +/************************************************************************** +** +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Installer Framework. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** +** $QT_END_LICENSE$ +** +**************************************************************************/ + +function Component() +{ + // constructor + component.loaded.connect(this, Component.prototype.loaded); + installer.addWizardPage(component, "Page", QInstaller.TargetDirectory) +} + +Component.prototype.createOperations = function() +{ + try { + // call the base create operations function + component.createOperations(); + } catch (e) { + print(e); + } +} + +Component.prototype.loaded = function () +{ + var page = gui.pageByObjectName("DynamicPage"); + if (page != null) { + page.entered.connect(Component.prototype.dynamicPageEntered); + } +} + +Component.prototype.dynamicPageEntered = function () +{ + var pageWidget = gui.pageWidgetByObjectName("DynamicPage"); + if (pageWidget != null) { + pageWidget.m_pageLabel.text = qsTr("This is a dynamically created page."); + } +} diff --git a/examples/translations/packages/com.vendor.product/meta/license.txt b/examples/translations/packages/com.vendor.product/meta/license.txt new file mode 100644 index 000000000..61a94dce7 --- /dev/null +++ b/examples/translations/packages/com.vendor.product/meta/license.txt @@ -0,0 +1 @@ +The fantastic license, have you heard of the Beer Public License Agreement yet? diff --git a/examples/translations/packages/com.vendor.product/meta/license_de.txt b/examples/translations/packages/com.vendor.product/meta/license_de.txt new file mode 100644 index 000000000..1af6f50fa --- /dev/null +++ b/examples/translations/packages/com.vendor.product/meta/license_de.txt @@ -0,0 +1 @@ +Lizenz auf deutsch. diff --git a/examples/translations/packages/com.vendor.product/meta/license_pl.txt b/examples/translations/packages/com.vendor.product/meta/license_pl.txt new file mode 100644 index 000000000..685636262 --- /dev/null +++ b/examples/translations/packages/com.vendor.product/meta/license_pl.txt @@ -0,0 +1 @@ +Licencja po polsku. diff --git a/examples/translations/packages/com.vendor.product/meta/package.xml b/examples/translations/packages/com.vendor.product/meta/package.xml new file mode 100644 index 000000000..1bdf34970 --- /dev/null +++ b/examples/translations/packages/com.vendor.product/meta/package.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Package> + <DisplayName>The root component</DisplayName> + <Description>This component contains a license and translations to German.</Description> + <Version>0.5.0-1</Version> + <ReleaseDate>2015-01-29</ReleaseDate> + <Licenses> + <License name="Beer Public License Agreement" file="license.txt" /> + </Licenses> + <Default>true</Default> + <Script>installscript.qs</Script> + <UserInterfaces> + <UserInterface>page.ui</UserInterface> + </UserInterfaces> + <Translations> + <Translation>de.qm</Translation> + <Translation>pl.qm</Translation> + </Translations> +</Package> diff --git a/examples/translations/packages/com.vendor.product/meta/page.ui b/examples/translations/packages/com.vendor.product/meta/page.ui new file mode 100644 index 000000000..0b5a2a68d --- /dev/null +++ b/examples/translations/packages/com.vendor.product/meta/page.ui @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Page</class> + <widget class="QWidget" name="Page"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Translations Example</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="m_pageLabel"> + <property name="frameShape"> + <enum>QFrame::Box</enum> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="m_pageLabel2"> + <property name="frameShape"> + <enum>QFrame::Box</enum> + </property> + <property name="text"> + <string>This is some text.</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/examples/translations/packages/com.vendor.product/meta/pl.ts b/examples/translations/packages/com.vendor.product/meta/pl.ts new file mode 100644 index 000000000..7f7649b51 --- /dev/null +++ b/examples/translations/packages/com.vendor.product/meta/pl.ts @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="pl_PL"> +<context> + <name>Page</name> + <message> + <location filename="page.ui" line="14"/> + <source>Translations Example</source> + <translation>Przykład obrazujący przekład na inny język</translation> + </message> + <message> + <location filename="page.ui" line="36"/> + <source>This is some text.</source> + <translation>To jest pewien tekst.</translation> + </message> +</context> +<context> + <name>installscript</name> + <message> + <location filename="installscript.qs" line="64"/> + <source>This is a dynamically created page.</source> + <translation>Jest to strona utworzona dynamicznie.</translation> + </message> +</context> +</TS> |