From 52ebff797da4a29f61459fd6d183d2e07498c591 Mon Sep 17 00:00:00 2001 From: Niels Weber Date: Thu, 29 Jan 2015 12:29:09 +0100 Subject: 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 --- .../doc/images/qtifw-examples-translations.png | Bin 0 -> 18683 bytes examples/doc/translations.qdoc | 80 +++++++++++++++++++++ examples/translations/README | 20 ++++++ examples/translations/config/config.xml | 9 +++ .../com.vendor.product/data/installcontent.txt | 2 + .../packages/com.vendor.product/meta/de.ts | 22 ++++++ .../com.vendor.product/meta/installscript.qs | 66 +++++++++++++++++ .../packages/com.vendor.product/meta/license.txt | 1 + .../com.vendor.product/meta/license_de.txt | 1 + .../com.vendor.product/meta/license_pl.txt | 1 + .../packages/com.vendor.product/meta/package.xml | 19 +++++ .../packages/com.vendor.product/meta/page.ui | 44 ++++++++++++ .../packages/com.vendor.product/meta/pl.ts | 25 +++++++ examples/translations/translations.pro | 13 ++++ 14 files changed, 303 insertions(+) create mode 100644 examples/doc/images/qtifw-examples-translations.png create mode 100644 examples/doc/translations.qdoc create mode 100644 examples/translations/README create mode 100644 examples/translations/config/config.xml create mode 100644 examples/translations/packages/com.vendor.product/data/installcontent.txt create mode 100644 examples/translations/packages/com.vendor.product/meta/de.ts create mode 100644 examples/translations/packages/com.vendor.product/meta/installscript.qs create mode 100644 examples/translations/packages/com.vendor.product/meta/license.txt create mode 100644 examples/translations/packages/com.vendor.product/meta/license_de.txt create mode 100644 examples/translations/packages/com.vendor.product/meta/license_pl.txt create mode 100644 examples/translations/packages/com.vendor.product/meta/package.xml create mode 100644 examples/translations/packages/com.vendor.product/meta/page.ui create mode 100644 examples/translations/packages/com.vendor.product/meta/pl.ts create mode 100644 examples/translations/translations.pro (limited to 'examples') diff --git a/examples/doc/images/qtifw-examples-translations.png b/examples/doc/images/qtifw-examples-translations.png new file mode 100644 index 000000000..1025c7c0c Binary files /dev/null and b/examples/doc/images/qtifw-examples-translations.png differ diff --git a/examples/doc/translations.qdoc b/examples/doc/translations.qdoc new file mode 100644 index 000000000..5ef579778 --- /dev/null +++ b/examples/doc/translations.qdoc @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** 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: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$ +** +****************************************************************************/ + +/*! + \example translations + \ingroup qtifwexamples + \title Translation Example + + \brief Using translations to localize installer pages and licenses. + + \image qtifw-examples-translations.png + + \e{Translations} illustrates how to use translations to localize the output + of component scripts and component UI files into another language. It also shows + how to select the license according to the system language. + + To add a new language, you first need to create a translation source (TS) file for + the package that contains all the translatable strings. Run the following command in + the package's meta directory: + + \code + lupdate installscript.qs page.ui -ts .ts + \endcode + + Replace with the two letter lowercase code for the language you want to + translate to. After finishing translating you need to use lrelease on that + TS file to generate the binary Qt messages (QM) file. Do not forget to include + that in the package.xml as shown below. Run the following command in + the package's meta directory: + + \code + lrelase .ts + \endcode + + + \include installerfw-examples-configuring.qdocinc + + \quotefile translations/config/config.xml + + \include installerfw-examples-packaging.qdocinc + + \list + \li The \c element is set to \c true to preselect the + component in the installer. + \li The \c + + page.ui + + + de.qm + pl.qm + + 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 @@ + + + Page + + + + 0 + 0 + 400 + 300 + + + + Translations Example + + + + + + QFrame::Box + + + Qt::AlignCenter + + + + + + + QFrame::Box + + + This is some text. + + + Qt::AlignCenter + + + + + + + + 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 @@ + + + + + Page + + + Translations Example + Przykład obrazujący przekład na inny język + + + + This is some text. + To jest pewien tekst. + + + + installscript + + + This is a dynamically created page. + Jest to strona utworzona dynamicznie. + + + diff --git a/examples/translations/translations.pro b/examples/translations/translations.pro new file mode 100644 index 000000000..415df49d5 --- /dev/null +++ b/examples/translations/translations.pro @@ -0,0 +1,13 @@ +TEMPLATE = aux + +INSTALLER = installer + +INPUT = $$PWD/config/config.xml $$PWD/packages +example.input = INPUT +example.output = $$INSTALLER +example.commands = ../../bin/binarycreator -c $$PWD/config/config.xml -p $$PWD/packages ${QMAKE_FILE_OUT} +example.CONFIG += target_predeps no_link combine + +QMAKE_EXTRA_COMPILERS += example + +OTHER_FILES = README -- cgit v1.2.3