diff options
author | Kai Köhne <kai.koehne@qt.io> | 2022-10-28 16:38:01 +0200 |
---|---|---|
committer | Kai Köhne <kai.koehne@qt.io> | 2022-11-07 14:08:25 +0100 |
commit | 7becc6264997609497135ec1b3eb18505d8e3305 (patch) | |
tree | c295516b0276a3ce99e0fa7390b6bf834ef83c35 /examples/linguist | |
parent | d95fbac8b41ba23269353e33e42a55e27f8d3b5f (diff) | |
download | qttools-7becc6264997609497135ec1b3eb18505d8e3305.tar.gz |
Move i18n example to qttools
Move i18n example out of qtbase, into qttools. Improve by
- removing hard-coded .qm files and .qrc file. Instead, use
CMake / qmake API.
- Add target language in .ts files
- Make file names match the locale (no->nb, jp->ja)
- Using QLocale::uiLanguages() instead of QLocale::system.name()
Change-Id: Ie7d496f38dd13078afab76eca3f7cff13ca27b68
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'examples/linguist')
25 files changed, 1238 insertions, 0 deletions
diff --git a/examples/linguist/CMakeLists.txt b/examples/linguist/CMakeLists.txt index 0786d80f2..43098b756 100644 --- a/examples/linguist/CMakeLists.txt +++ b/examples/linguist/CMakeLists.txt @@ -3,4 +3,5 @@ qt_internal_add_example(arrowpad) qt_internal_add_example(hellotr) +qt_internal_add_example(i18n) qt_internal_add_example(trollprint) diff --git a/examples/linguist/doc/images/linguist-i18n.png b/examples/linguist/doc/images/linguist-i18n.png Binary files differnew file mode 100644 index 000000000..20c46c9e6 --- /dev/null +++ b/examples/linguist/doc/images/linguist-i18n.png diff --git a/examples/linguist/doc/src/i18n.qdoc b/examples/linguist/doc/src/i18n.qdoc new file mode 100644 index 000000000..769086461 --- /dev/null +++ b/examples/linguist/doc/src/i18n.qdoc @@ -0,0 +1,17 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! + \example i18n + \title I18N Example + \ingroup examples-linguist + \brief Demonstrates Qt's support for translated text. + + The Internationalization (I18N) example demonstrates Qt's support for translated + text. Developers can write the initial application text in one language, and + translations can be provided later without any modifications to the code. It also + demonstrates how to detect the system language settings and show the UI in the appropriate + languages. + + \image linguist-i18n.png +*/ diff --git a/examples/linguist/i18n/CMakeLists.txt b/examples/linguist/i18n/CMakeLists.txt new file mode 100644 index 000000000..2cb380aa2 --- /dev/null +++ b/examples/linguist/i18n/CMakeLists.txt @@ -0,0 +1,55 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +cmake_minimum_required(VERSION 3.16) +project(i18n LANGUAGES CXX) + +set(CMAKE_AUTOMOC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/i18n") + +find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets LinguistTools) + +qt_add_executable(i18n + languagechooser.cpp languagechooser.h + main.cpp + mainwindow.cpp mainwindow.h +) + +set_target_properties(i18n PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) + +target_link_libraries(i18n PUBLIC + Qt::Core + Qt::Gui + Qt::Widgets +) + +qt_add_translations(i18n TS_FILES + translations/i18n_ar.ts + translations/i18n_cs.ts + translations/i18n_de.ts + translations/i18n_el.ts + translations/i18n_en.ts + translations/i18n_eo.ts + translations/i18n_fr.ts + translations/i18n_it.ts + translations/i18n_ja.ts + translations/i18n_ko.ts + translations/i18n_nb.ts + translations/i18n_ru.ts + translations/i18n_sv.ts + translations/i18n_zh.ts +) + +install(TARGETS i18n + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/linguist/i18n/i18n.pro b/examples/linguist/i18n/i18n.pro new file mode 100644 index 000000000..c15d78007 --- /dev/null +++ b/examples/linguist/i18n/i18n.pro @@ -0,0 +1,32 @@ +CONFIG += lrelease embed_translations + +QT += widgets + +HEADERS = \ + languagechooser.h \ + mainwindow.h + +SOURCES = \ + languagechooser.cpp \ + main.cpp \ + mainwindow.cpp + +TRANSLATIONS += \ + translations/i18n_ar.ts \ + translations/i18n_cs.ts \ + translations/i18n_de.ts \ + translations/i18n_el.ts \ + translations/i18n_en.ts \ + translations/i18n_eo.ts \ + translations/i18n_fr.ts \ + translations/i18n_it.ts \ + translations/i18n_ja.ts \ + translations/i18n_ko.ts \ + translations/i18n_nb.ts \ + translations/i18n_ru.ts \ + translations/i18n_sv.ts \ + translations/i18n_zh.ts + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/i18n +INSTALLS += target diff --git a/examples/linguist/i18n/languagechooser.cpp b/examples/linguist/i18n/languagechooser.cpp new file mode 100644 index 000000000..0878c68d7 --- /dev/null +++ b/examples/linguist/i18n/languagechooser.cpp @@ -0,0 +1,141 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include "languagechooser.h" +#include "mainwindow.h" + +#include <QCoreApplication> +#include <QCheckBox> +#include <QDialogButtonBox> +#include <QDir> +#include <QGridLayout> +#include <QGroupBox> +#include <QPushButton> +#include <QTranslator> + +#include <algorithm> + +LanguageChooser::LanguageChooser(QWidget *parent) : QDialog(parent, Qt::WindowStaysOnTopHint) +{ + groupBox = new QGroupBox("Languages"); + + QGridLayout *groupBoxLayout = new QGridLayout; + + const QStringList qmFiles = findQmFiles(); + const QStringList uiLanguages = QLocale::system().uiLanguages(); + for (int i = 0; i < qmFiles.size(); ++i) { + const QString &qmlFile = qmFiles.at(i); + QCheckBox *checkBox = new QCheckBox(languageName(qmlFile)); + qmFileForCheckBoxMap.insert(checkBox, qmlFile); + connect(checkBox, &QCheckBox::toggled, this, &LanguageChooser::checkBoxToggled); + if (std::find_if( + uiLanguages.begin(), uiLanguages.end(), + [qmlFile](const QString &lang) -> bool { return languageMatch(lang, qmlFile); }) + != uiLanguages.end()) + checkBox->setCheckState(Qt::Checked); + groupBoxLayout->addWidget(checkBox, i / 2, i % 2); + } + groupBox->setLayout(groupBoxLayout); + + buttonBox = new QDialogButtonBox; + showAllButton = buttonBox->addButton("Show All", QDialogButtonBox::ActionRole); + hideAllButton = buttonBox->addButton("Hide All", QDialogButtonBox::ActionRole); + + connect(showAllButton, &QAbstractButton::clicked, this, &LanguageChooser::showAll); + connect(hideAllButton, &QAbstractButton::clicked, this, &LanguageChooser::hideAll); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addWidget(groupBox); + mainLayout->addWidget(buttonBox); + setLayout(mainLayout); + + setWindowTitle("I18N"); +} + +bool LanguageChooser::languageMatch(QStringView lang, QStringView qmFile) +{ + // qmFile: i18n_xx.qm + const QStringView prefix{ u"i18n_" }; + const int langTokenLength = 2; /*FIXME: is checking two chars enough?*/ + return qmFile.mid(qmFile.indexOf(prefix) + prefix.length(), langTokenLength) + == lang.left(langTokenLength); +} + +bool LanguageChooser::eventFilter(QObject *object, QEvent *event) +{ + if (event->type() == QEvent::Close) { + MainWindow *window = qobject_cast<MainWindow *>(object); + if (window) { + QCheckBox *checkBox = mainWindowForCheckBoxMap.key(window); + if (checkBox) + checkBox->setChecked(false); + } + } + return QDialog::eventFilter(object, event); +} + +void LanguageChooser::closeEvent(QCloseEvent * /* event */) +{ + QCoreApplication::quit(); +} + +void LanguageChooser::checkBoxToggled() +{ + QCheckBox *checkBox = qobject_cast<QCheckBox *>(sender()); + MainWindow *window = mainWindowForCheckBoxMap.value(checkBox); + if (!window) { + QTranslator translator; + const QString qmlFile = qmFileForCheckBoxMap.value(checkBox); + if (translator.load(qmlFile)) + QCoreApplication::installTranslator(&translator); + else + qWarning("Unable to load %s", qPrintable(QDir::toNativeSeparators(qmlFile))); + + window = new MainWindow; + window->setPalette(colorForLanguage(checkBox->text())); + + window->installEventFilter(this); + mainWindowForCheckBoxMap.insert(checkBox, window); + } + window->setVisible(checkBox->isChecked()); +} + +void LanguageChooser::showAll() +{ + for (auto it = qmFileForCheckBoxMap.keyBegin(); it != qmFileForCheckBoxMap.keyEnd(); ++it) + (*it)->setChecked(true); +} + +void LanguageChooser::hideAll() +{ + for (auto it = qmFileForCheckBoxMap.keyBegin(); it != qmFileForCheckBoxMap.keyEnd(); ++it) + (*it)->setChecked(false); +} + +QStringList LanguageChooser::findQmFiles() +{ + QDir dir(":/i18n"); + QStringList fileNames = dir.entryList(QStringList("*.qm"), QDir::Files, QDir::Name); + for (QString &fileName : fileNames) + fileName = dir.filePath(fileName); + return fileNames; +} + +QString LanguageChooser::languageName(const QString &qmFile) +{ + QTranslator translator; + if (!translator.load(qmFile)) { + qWarning("Unable to load %s", qPrintable(QDir::toNativeSeparators(qmFile))); + return {}; + } + return translator.translate("MainWindow", "English"); +} + +QColor LanguageChooser::colorForLanguage(const QString &language) +{ + size_t hashValue = qHash(language); + int red = 156 + (hashValue & 0x3F); + int green = 156 + ((hashValue >> 6) & 0x3F); + int blue = 156 + ((hashValue >> 12) & 0x3F); + return QColor(red, green, blue); +} diff --git a/examples/linguist/i18n/languagechooser.h b/examples/linguist/i18n/languagechooser.h new file mode 100644 index 000000000..789f76203 --- /dev/null +++ b/examples/linguist/i18n/languagechooser.h @@ -0,0 +1,50 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#ifndef LANGUAGECHOOSER_H +#define LANGUAGECHOOSER_H + +#include <QDialog> +#include <QHash> +#include <QStringList> + +QT_BEGIN_NAMESPACE +class QAbstractButton; +class QCheckBox; +class QDialogButtonBox; +class QGroupBox; +QT_END_NAMESPACE + +class MainWindow; + +class LanguageChooser : public QDialog +{ + Q_OBJECT + +public: + explicit LanguageChooser(QWidget *parent = nullptr); + +protected: + bool eventFilter(QObject *object, QEvent *event) override; + void closeEvent(QCloseEvent *event) override; + +private slots: + void checkBoxToggled(); + void showAll(); + void hideAll(); + +private: + static QStringList findQmFiles(); + static QString languageName(const QString &qmFile); + static QColor colorForLanguage(const QString &language); + static bool languageMatch(QStringView lang, QStringView qmFile); + + QGroupBox *groupBox; + QDialogButtonBox *buttonBox; + QAbstractButton *showAllButton; + QAbstractButton *hideAllButton; + QHash<QCheckBox *, QString> qmFileForCheckBoxMap; + QHash<QCheckBox *, MainWindow *> mainWindowForCheckBoxMap; +}; + +#endif // LANGUAGECHOOSER_H diff --git a/examples/linguist/i18n/main.cpp b/examples/linguist/i18n/main.cpp new file mode 100644 index 000000000..f93166102 --- /dev/null +++ b/examples/linguist/i18n/main.cpp @@ -0,0 +1,14 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include "languagechooser.h" + +#include <QApplication> + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + LanguageChooser chooser; + chooser.show(); + return app.exec(); +} diff --git a/examples/linguist/i18n/mainwindow.cpp b/examples/linguist/i18n/mainwindow.cpp new file mode 100644 index 000000000..6b8f5b52b --- /dev/null +++ b/examples/linguist/i18n/mainwindow.cpp @@ -0,0 +1,62 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include "mainwindow.h" + +#include <QAction> +#include <QCoreApplication> +#include <QGroupBox> +#include <QListWidget> +#include <QMenuBar> +#include <QRadioButton> +#include <QStatusBar> +#include <QVBoxLayout> + +static const char *const listEntries[] = { QT_TRANSLATE_NOOP("MainWindow", "First"), + QT_TRANSLATE_NOOP("MainWindow", "Second"), + QT_TRANSLATE_NOOP("MainWindow", "Third"), nullptr }; + +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) +{ + centralWidget = new QWidget; + setCentralWidget(centralWidget); + + createGroupBox(); + + listWidget = new QListWidget; + for (const char *entry : listEntries) + listWidget->addItem(tr(entry)); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addWidget(groupBox); + mainLayout->addWidget(listWidget); + centralWidget->setLayout(mainLayout); + + exitAction = new QAction(tr("E&xit"), this); + connect(exitAction, &QAction::triggered, qApp, QCoreApplication::quit); + + fileMenu = menuBar()->addMenu(tr("&File")); + fileMenu->setPalette(QPalette(Qt::red)); + fileMenu->addAction(exitAction); + + setWindowTitle(tr("Language: %1").arg(tr("English"))); + statusBar()->showMessage(tr("Internationalization Example")); + + if (tr("LTR") == "RTL") + setLayoutDirection(Qt::RightToLeft); +} + +void MainWindow::createGroupBox() +{ + groupBox = new QGroupBox(tr("View")); + perspectiveRadioButton = new QRadioButton(tr("Perspective")); + isometricRadioButton = new QRadioButton(tr("Isometric")); + obliqueRadioButton = new QRadioButton(tr("Oblique")); + perspectiveRadioButton->setChecked(true); + + QVBoxLayout *groupBoxLayout = new QVBoxLayout; + groupBoxLayout->addWidget(perspectiveRadioButton); + groupBoxLayout->addWidget(isometricRadioButton); + groupBoxLayout->addWidget(obliqueRadioButton); + groupBox->setLayout(groupBoxLayout); +} diff --git a/examples/linguist/i18n/mainwindow.h b/examples/linguist/i18n/mainwindow.h new file mode 100644 index 000000000..93b75fd27 --- /dev/null +++ b/examples/linguist/i18n/mainwindow.h @@ -0,0 +1,39 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QMainWindow> + +QT_BEGIN_NAMESPACE +class QAction; +class QGroupBox; +class QLabel; +class QListWidget; +class QMenu; +class QRadioButton; +QT_END_NAMESPACE + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = nullptr); + +private: + void createGroupBox(); + + QWidget *centralWidget; + QLabel *label; + QGroupBox *groupBox; + QListWidget *listWidget; + QRadioButton *perspectiveRadioButton; + QRadioButton *isometricRadioButton; + QRadioButton *obliqueRadioButton; + QMenu *fileMenu; + QAction *exitAction; +}; + +#endif // MAINWINDOW_H diff --git a/examples/linguist/i18n/translations/i18n_ar.ts b/examples/linguist/i18n/translations/i18n_ar.ts new file mode 100644 index 000000000..f575f2b2a --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_ar.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="ar_EG"> +<context> + <name>MainWindow</name> + <message> + <source>First</source> + <translation>أول</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>مثال التدويل</translation> + </message> + <message> + <source>Isometric</source> + <translation>متماثل</translation> + </message> + <message> + <source>Language: %1</source> + <translation>اللغة: %1</translation> + </message> + <message> + <source>English</source> + <translation>العربية</translation> + </message> + <message> + <source>Oblique</source> + <translation>مصمت</translation> + </message> + <message> + <source>Perspective</source> + <translation>منظور</translation> + </message> + <message> + <source>Second</source> + <translation>ثانى</translation> + </message> + <message> + <source>Third</source> + <translation>ثالث</translation> + </message> + <message> + <source>View</source> + <translation>مرئى</translation> + </message> + <message> + <source>E&xit</source> + <translation>أخرج</translation> + </message> + <message> + <source>&File</source> + <translation>الملف</translation> + </message> + <message> + <source>LTR</source> + <translation>RTL</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/i18n/translations/i18n_cs.ts b/examples/linguist/i18n/translations/i18n_cs.ts new file mode 100644 index 000000000..d05d5c875 --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_cs.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="cs_CZ"> +<context> + <name>MainWindow</name> + <message> + <source>View</source> + <translation>Pohled</translation> + </message> + <message> + <source>&File</source> + <translation>&Soubor</translation> + </message> + <message> + <source>E&xit</source> + <translation>&Konec</translation> + </message> + <message> + <source>First</source> + <translation>První</translation> + </message> + <message> + <source>Third</source> + <translation>Třetí</translation> + </message> + <message> + <source>Language: %1</source> + <translation>Jayzk: %1</translation> + </message> + <message> + <source>English</source> + <translation>Český</translation> + </message> + <message> + <source>Oblique</source> + <translation>Nakloněný</translation> + </message> + <message> + <source>Second</source> + <translation>Druhý</translation> + </message> + <message> + <source>Isometric</source> + <translation>Isometrický</translation> + </message> + <message> + <source>Perspective</source> + <translation>Perspektivní</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>Ukázka lokalizace</translation> + </message> + <message> + <source>LTR</source> + <translation>LTR</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/i18n/translations/i18n_de.ts b/examples/linguist/i18n/translations/i18n_de.ts new file mode 100644 index 000000000..155b6b54d --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_de.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="de_DE"> +<context> + <name>MainWindow</name> + <message> + <source>View</source> + <translation>Ansicht</translation> + </message> + <message> + <source>&File</source> + <translation>&Datei</translation> + </message> + <message> + <source>E&xit</source> + <translation>Be&enden</translation> + </message> + <message> + <source>First</source> + <translation>Erstens</translation> + </message> + <message> + <source>Third</source> + <translation>Drittens</translation> + </message> + <message> + <source>English</source> + <translation>Deutsch</translation> + </message> + <message> + <source>Language: %1</source> + <translation>Sprache: %1</translation> + </message> + <message> + <source>Oblique</source> + <translation>Schief</translation> + </message> + <message> + <source>Second</source> + <translation>Zweitens</translation> + </message> + <message> + <source>Isometric</source> + <translation>Isometrisch</translation> + </message> + <message> + <source>Perspective</source> + <translation>Perspektivisch</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>Internationalisierungsbeispiel</translation> + </message> + <message> + <source>LTR</source> + <translation>LTR</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/i18n/translations/i18n_el.ts b/examples/linguist/i18n/translations/i18n_el.ts new file mode 100644 index 000000000..e87ef2431 --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_el.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="el_GR"> +<context> + <name>MainWindow</name> + <message> + <source>&File</source> + <translation>&Αρχείο</translation> + </message> + <message> + <source>E&xit</source> + <translation>Έ&ξοδος</translation> + </message> + <message> + <source>First</source> + <translation>Πρώτο</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>Παράδειγμα διεθνοποίησης</translation> + </message> + <message> + <source>Isometric</source> + <translation>Ισομετρική</translation> + </message> + <message> + <source>Language: %1</source> + <translation>Γλώσσα: %1</translation> + </message> + <message> + <source>English</source> + <translation>Ελληνικά</translation> + </message> + <message> + <source>Oblique</source> + <translation>Πλάγια</translation> + </message> + <message> + <source>Perspective</source> + <translation>Προοπτική</translation> + </message> + <message> + <source>Second</source> + <translation>Δεύτερο</translation> + </message> + <message> + <source>Third</source> + <translation>Τρίτο</translation> + </message> + <message> + <source>View</source> + <translation>Όψη</translation> + </message> + <message> + <source>LTR</source> + <translation>LTR</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/i18n/translations/i18n_en.ts b/examples/linguist/i18n/translations/i18n_en.ts new file mode 100644 index 000000000..9c6c0bf9b --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_en.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="en_US"> +<context> + <name>MainWindow</name> + <message> + <source>E&xit</source> + <translation>E&xit</translation> + </message> + <message> + <source>&File</source> + <translation>&File</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>Internationalization Example</translation> + </message> + <message> + <source>Language: %1</source> + <translation>Language: %1</translation> + </message> + <message> + <source>English</source> + <translation>English</translation> + </message> + <message> + <source>View</source> + <translation>View</translation> + </message> + <message> + <source>Perspective</source> + <translation>Perspective</translation> + </message> + <message> + <source>Isometric</source> + <translation>Isometric</translation> + </message> + <message> + <source>Oblique</source> + <translation>Oblique</translation> + </message> + <message> + <source>First</source> + <translation>First</translation> + </message> + <message> + <source>Second</source> + <translation>Second</translation> + </message> + <message> + <source>Third</source> + <translation>Third</translation> + </message> + <message> + <source>LTR</source> + <translation>LTR</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/i18n/translations/i18n_eo.ts b/examples/linguist/i18n/translations/i18n_eo.ts new file mode 100644 index 000000000..0e95f9df3 --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_eo.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="eo_001"> +<context> + <name>MainWindow</name> + <message> + <source>&File</source> + <translation>&Dosiero</translation> + </message> + <message> + <source>First</source> + <translation>Unue</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>Ekzemplo pri internaciigo</translation> + </message> + <message> + <source>Isometric</source> + <translation>Isometria</translation> + </message> + <message> + <source>Language: %1</source> + <translation>Lingvo: %1</translation> + </message> + <message> + <source>English</source> + <translation>Esperanto</translation> + </message> + <message> + <source>Oblique</source> + <translation>Oblikva</translation> + </message> + <message> + <source>Perspective</source> + <translation>Perspektiva</translation> + </message> + <message> + <source>Second</source> + <translation>Due</translation> + </message> + <message> + <source>Third</source> + <translation>Trie</translation> + </message> + <message> + <source>View</source> + <translation>Aspekto</translation> + </message> + <message> + <source>E&xit</source> + <translation>&Fini</translation> + </message> + <message> + <source>LTR</source> + <translation>LTR</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/i18n/translations/i18n_fr.ts b/examples/linguist/i18n/translations/i18n_fr.ts new file mode 100644 index 000000000..58cdd7a58 --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_fr.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="fr_FR"> +<context> + <name>MainWindow</name> + <message> + <source>View</source> + <translation>Vue</translation> + </message> + <message> + <source>&File</source> + <translation>&Fichier</translation> + </message> + <message> + <source>E&xit</source> + <translation>&Quitter</translation> + </message> + <message> + <source>First</source> + <translation>Premier</translation> + </message> + <message> + <source>Third</source> + <translation>Troisième</translation> + </message> + <message> + <source>Language: %1</source> + <translation>Langue : %1</translation> + </message> + <message> + <source>English</source> + <translation>Français</translation> + </message> + <message> + <source>Oblique</source> + <translation>Oblique</translation> + </message> + <message> + <source>Second</source> + <translation>Deuxième</translation> + </message> + <message> + <source>Isometric</source> + <translation>Isométrique</translation> + </message> + <message> + <source>Perspective</source> + <translation>Perspective</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>Exemple d'internationalisation</translation> + </message> + <message> + <source>LTR</source> + <translation>LTR</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/i18n/translations/i18n_it.ts b/examples/linguist/i18n/translations/i18n_it.ts new file mode 100644 index 000000000..62facf0dc --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_it.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="it_IT"> +<context> + <name>MainWindow</name> + <message> + <source>First</source> + <translation>Primo</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>Esempio di localizzazione</translation> + </message> + <message> + <source>Isometric</source> + <translation>Isometrica</translation> + </message> + <message> + <source>Language: %1</source> + <translation>Lingua: %1</translation> + </message> + <message> + <source>English</source> + <translation>Italiano</translation> + </message> + <message> + <source>Oblique</source> + <translation>Obliqua</translation> + </message> + <message> + <source>Perspective</source> + <translation>Prospettica</translation> + </message> + <message> + <source>Second</source> + <translation>Secondo</translation> + </message> + <message> + <source>Third</source> + <translation>Terzo</translation> + </message> + <message> + <source>View</source> + <translation>Vista</translation> + </message> + <message> + <source>E&xit</source> + <translation>&Esci</translation> + </message> + <message> + <source>&File</source> + <translation>&File</translation> + </message> + <message> + <source>LTR</source> + <translation>LTR</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/i18n/translations/i18n_ja.ts b/examples/linguist/i18n/translations/i18n_ja.ts new file mode 100644 index 000000000..e7fe10a38 --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_ja.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="ja_JP"> +<context> + <name>MainWindow</name> + <message> + <source>&File</source> + <translation>ファイル(&F)</translation> + </message> + <message> + <source>E&xit</source> + <translation>終了(&X)</translation> + </message> + <message> + <source>First</source> + <translation>第一行</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>国際化(i18n)の例</translation> + </message> + <message> + <source>Isometric</source> + <translation>等角投影法</translation> + </message> + <message> + <source>Language: %1</source> + <translation>言語: %1</translation> + </message> + <message> + <source>English</source> + <translation>日本語</translation> + </message> + <message> + <source>Oblique</source> + <translation>斜め投影法</translation> + </message> + <message> + <source>Perspective</source> + <translation>遠近法</translation> + </message> + <message> + <source>Second</source> + <translation>第二行</translation> + </message> + <message> + <source>Third</source> + <translation>第三行</translation> + </message> + <message> + <source>View</source> + <translation>表示方式</translation> + </message> + <message> + <source>LTR</source> + <translation>LTR</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/i18n/translations/i18n_ko.ts b/examples/linguist/i18n/translations/i18n_ko.ts new file mode 100644 index 000000000..ab921c8df --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_ko.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="ko_KR"> +<context> + <name>MainWindow</name> + <message> + <source>&File</source> + <translation>파일&F</translation> + </message> + <message> + <source>E&xit</source> + <translation>종료&X</translation> + </message> + <message> + <source>First</source> + <translation>첫번째</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>국제화 예제</translation> + </message> + <message> + <source>Isometric</source> + <translation>등측도</translation> + </message> + <message> + <source>Language: %1</source> + <translation>언어 : %1</translation> + </message> + <message> + <source>English</source> + <translation>한국어</translation> + </message> + <message> + <source>Oblique</source> + <translation>빗각</translation> + </message> + <message> + <source>Perspective</source> + <translation>원근화법</translation> + </message> + <message> + <source>Second</source> + <translation>두번째</translation> + </message> + <message> + <source>Third</source> + <translation>세번째</translation> + </message> + <message> + <source>View</source> + <translation>보기</translation> + </message> + <message> + <source>LTR</source> + <translation>LTR</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/i18n/translations/i18n_nb.ts b/examples/linguist/i18n/translations/i18n_nb.ts new file mode 100644 index 000000000..076ed3a05 --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_nb.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="nb_NO"> +<context> + <name>MainWindow</name> + <message> + <source>View</source> + <translation>Vis</translation> + </message> + <message> + <source>&File</source> + <translation>&Fil</translation> + </message> + <message> + <source>E&xit</source> + <translation>&Avslutt</translation> + </message> + <message> + <source>First</source> + <translation>Første</translation> + </message> + <message> + <source>Third</source> + <translation>Tredje</translation> + </message> + <message> + <source>Language: %1</source> + <translation>Språk: %1</translation> + </message> + <message> + <source>English</source> + <translation>Norsk</translation> + </message> + <message> + <source>Oblique</source> + <translation>Skjevt</translation> + </message> + <message> + <source>Second</source> + <translation>Andre</translation> + </message> + <message> + <source>Isometric</source> + <translation>Isometrisk</translation> + </message> + <message> + <source>Perspective</source> + <translation>Perspektiv</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>Internasjonaliseringseksempel</translation> + </message> + <message> + <source>LTR</source> + <translation>LTR</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/i18n/translations/i18n_ru.ts b/examples/linguist/i18n/translations/i18n_ru.ts new file mode 100644 index 000000000..7c7645d44 --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_ru.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="ru_RU"> +<context> + <name>MainWindow</name> + <message> + <source>View</source> + <translation>Вид</translation> + </message> + <message> + <source>&File</source> + <translation>Файл</translation> + </message> + <message> + <source>E&xit</source> + <translation>Выход</translation> + </message> + <message> + <source>First</source> + <translation>Первый</translation> + </message> + <message> + <source>Third</source> + <translation>Третий</translation> + </message> + <message> + <source>Language: %1</source> + <translation>Язык: %1</translation> + </message> + <message> + <source>English</source> + <translation>Русский</translation> + </message> + <message> + <source>Oblique</source> + <translation>Курсив</translation> + </message> + <message> + <source>Second</source> + <translation>Второй</translation> + </message> + <message> + <source>Isometric</source> + <translation>Изометрический</translation> + </message> + <message> + <source>Perspective</source> + <translation>Перспектива</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>Пример интернационализации</translation> + </message> + <message> + <source>LTR</source> + <translation>LTR</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/i18n/translations/i18n_sv.ts b/examples/linguist/i18n/translations/i18n_sv.ts new file mode 100644 index 000000000..b7b3a45fa --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_sv.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="sv_SE"> +<context> + <name>MainWindow</name> + <message> + <source>View</source> + <translation>Visa</translation> + </message> + <message> + <source>&File</source> + <translation>&Arkiv</translation> + </message> + <message> + <source>E&xit</source> + <translation>&Avsluta</translation> + </message> + <message> + <source>First</source> + <translation>Första</translation> + </message> + <message> + <source>Third</source> + <translation>Tredje</translation> + </message> + <message> + <source>Language: %1</source> + <translation>Språk: %1</translation> + </message> + <message> + <source>English</source> + <translation>Svenska</translation> + </message> + <message> + <source>Oblique</source> + <translation>Skevt</translation> + </message> + <message> + <source>Second</source> + <translation>Andra</translation> + </message> + <message> + <source>Isometric</source> + <translation>Isometriskt</translation> + </message> + <message> + <source>Perspective</source> + <translation>Perspektivt</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>Internationaliseringsexempel</translation> + </message> + <message> + <source>LTR</source> + <translation>LTR</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/i18n/translations/i18n_zh.ts b/examples/linguist/i18n/translations/i18n_zh.ts new file mode 100644 index 000000000..8701d76af --- /dev/null +++ b/examples/linguist/i18n/translations/i18n_zh.ts @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="zh_CN"> +<context> + <name>MainWindow</name> + <message> + <source>View</source> + <translation>视图</translation> + </message> + <message> + <source>&File</source> + <translation>文件[&F]</translation> + </message> + <message> + <source>E&xit</source> + <translation>退出[&x]</translation> + </message> + <message> + <source>First</source> + <translation>第一个</translation> + </message> + <message> + <source>Third</source> + <translation>第三个</translation> + </message> + <message> + <source>Language: %1</source> + <translation>语言: %1</translation> + </message> + <message> + <source>English</source> + <translation>简体中文</translation> + </message> + <message> + <source>Oblique</source> + <translation>斜投影</translation> + </message> + <message> + <source>Second</source> + <translation>第二个</translation> + </message> + <message> + <source>Isometric</source> + <translation>等角投影</translation> + </message> + <message> + <source>Perspective</source> + <translation>透视投影</translation> + </message> + <message> + <source>Internationalization Example</source> + <translation>国际化范例</translation> + </message> + <message> + <source>LTR</source> + <translation>LTR</translation> + </message> +</context> +</TS> diff --git a/examples/linguist/linguist.pro b/examples/linguist/linguist.pro index 79e96820c..2d30450de 100644 --- a/examples/linguist/linguist.pro +++ b/examples/linguist/linguist.pro @@ -1,4 +1,5 @@ TEMPLATE = subdirs SUBDIRS = arrowpad \ hellotr \ + i18n \ trollprint |