summaryrefslogtreecommitdiffstats
path: root/examples/linguist
diff options
context:
space:
mode:
Diffstat (limited to 'examples/linguist')
-rw-r--r--examples/linguist/CMakeLists.txt10
-rw-r--r--examples/linguist/arrowpad/CMakeLists.txt28
-rw-r--r--examples/linguist/arrowpad/arrowpad.cpp51
-rw-r--r--examples/linguist/arrowpad/arrowpad.h51
-rw-r--r--examples/linguist/arrowpad/arrowpad_fr.ts3
-rw-r--r--examples/linguist/arrowpad/arrowpad_nl.ts3
-rw-r--r--examples/linguist/arrowpad/main.cpp55
-rw-r--r--examples/linguist/arrowpad/mainwindow.cpp55
-rw-r--r--examples/linguist/arrowpad/mainwindow.h51
-rw-r--r--examples/linguist/doc/images/linguist-i18n.pngbin0 -> 22531 bytes
-rw-r--r--examples/linguist/doc/snippets/doc_src_examples_arrowpad.cpp51
-rw-r--r--examples/linguist/doc/snippets/doc_src_examples_arrowpad.qdoc65
-rw-r--r--examples/linguist/doc/snippets/doc_src_examples_hellotr.qdoc55
-rw-r--r--examples/linguist/doc/snippets/doc_src_examples_trollprint.cpp51
-rw-r--r--examples/linguist/doc/src/arrowpad.qdoc76
-rw-r--r--examples/linguist/doc/src/hellotr.qdoc65
-rw-r--r--examples/linguist/doc/src/i18n.qdoc20
-rw-r--r--examples/linguist/doc/src/trollprint.qdoc53
-rw-r--r--examples/linguist/hellotr/CMakeLists.txt28
-rw-r--r--examples/linguist/hellotr/hellotr_la.ts3
-rw-r--r--examples/linguist/hellotr/main.cpp54
-rw-r--r--examples/linguist/i18n/CMakeLists.txt46
-rw-r--r--examples/linguist/i18n/i18n.pro32
-rw-r--r--examples/linguist/i18n/languagechooser.cpp141
-rw-r--r--examples/linguist/i18n/languagechooser.h50
-rw-r--r--examples/linguist/i18n/main.cpp14
-rw-r--r--examples/linguist/i18n/mainwindow.cpp62
-rw-r--r--examples/linguist/i18n/mainwindow.h39
-rw-r--r--examples/linguist/i18n/translations/i18n_ar.ts59
-rw-r--r--examples/linguist/i18n/translations/i18n_cs.ts59
-rw-r--r--examples/linguist/i18n/translations/i18n_de.ts59
-rw-r--r--examples/linguist/i18n/translations/i18n_el.ts59
-rw-r--r--examples/linguist/i18n/translations/i18n_en.ts59
-rw-r--r--examples/linguist/i18n/translations/i18n_eo.ts59
-rw-r--r--examples/linguist/i18n/translations/i18n_fr.ts59
-rw-r--r--examples/linguist/i18n/translations/i18n_it.ts59
-rw-r--r--examples/linguist/i18n/translations/i18n_ja.ts59
-rw-r--r--examples/linguist/i18n/translations/i18n_ko.ts59
-rw-r--r--examples/linguist/i18n/translations/i18n_nb.ts59
-rw-r--r--examples/linguist/i18n/translations/i18n_ru.ts59
-rw-r--r--examples/linguist/i18n/translations/i18n_sv.ts59
-rw-r--r--examples/linguist/i18n/translations/i18n_zh.ts59
-rw-r--r--examples/linguist/linguist.pro1
-rw-r--r--examples/linguist/trollprint/CMakeLists.txt25
-rw-r--r--examples/linguist/trollprint/main.cpp55
-rw-r--r--examples/linguist/trollprint/mainwindow.cpp65
-rw-r--r--examples/linguist/trollprint/mainwindow.h51
-rw-r--r--examples/linguist/trollprint/printpanel.cpp51
-rw-r--r--examples/linguist/trollprint/printpanel.h51
-rw-r--r--examples/linguist/trollprint/trollprint_pt.ts16
50 files changed, 1440 insertions, 913 deletions
diff --git a/examples/linguist/CMakeLists.txt b/examples/linguist/CMakeLists.txt
index 612ae91cc..c05860782 100644
--- a/examples/linguist/CMakeLists.txt
+++ b/examples/linguist/CMakeLists.txt
@@ -1,5 +1,7 @@
-# Generated from linguist.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-add_subdirectory(arrowpad)
-add_subdirectory(hellotr)
-add_subdirectory(trollprint)
+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/arrowpad/CMakeLists.txt b/examples/linguist/arrowpad/CMakeLists.txt
index 94b003262..08fc69693 100644
--- a/examples/linguist/arrowpad/CMakeLists.txt
+++ b/examples/linguist/arrowpad/CMakeLists.txt
@@ -1,33 +1,39 @@
-# Generated from arrowpad.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(arrowpad LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/linguist/arrowpad")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+#! [0]
+find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
+
+qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES fr nl)
+#! [0]
qt_add_executable(arrowpad
arrowpad.cpp arrowpad.h
main.cpp
mainwindow.cpp mainwindow.h
)
+
+#! [1]
+qt6_add_translations(arrowpad
+ QM_FILES_OUTPUT_VARIABLE qm_files)
+install(FILES ${qm_files} DESTINATION ${INSTALL_EXAMPLEDIR})
+#! [1]
set_target_properties(arrowpad PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(arrowpad PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/linguist/arrowpad/arrowpad.cpp b/examples/linguist/arrowpad/arrowpad.cpp
index 8992d4795..86771ec37 100644
--- a/examples/linguist/arrowpad/arrowpad.cpp
+++ b/examples/linguist/arrowpad/arrowpad.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
diff --git a/examples/linguist/arrowpad/arrowpad.h b/examples/linguist/arrowpad/arrowpad.h
index 872dc4fc5..f908baa7a 100644
--- a/examples/linguist/arrowpad/arrowpad.h
+++ b/examples/linguist/arrowpad/arrowpad.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef ARROWPAD_H
#define ARROWPAD_H
diff --git a/examples/linguist/arrowpad/arrowpad_fr.ts b/examples/linguist/arrowpad/arrowpad_fr.ts
new file mode 100644
index 000000000..1f068c5de
--- /dev/null
+++ b/examples/linguist/arrowpad/arrowpad_fr.ts
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS/>
diff --git a/examples/linguist/arrowpad/arrowpad_nl.ts b/examples/linguist/arrowpad/arrowpad_nl.ts
new file mode 100644
index 000000000..1f068c5de
--- /dev/null
+++ b/examples/linguist/arrowpad/arrowpad_nl.ts
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS/>
diff --git a/examples/linguist/arrowpad/main.cpp b/examples/linguist/arrowpad/main.cpp
index d25c11959..44581050e 100644
--- a/examples/linguist/arrowpad/main.cpp
+++ b/examples/linguist/arrowpad/main.cpp
@@ -1,57 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
#include "mainwindow.h"
+using namespace Qt::StringLiterals;
+
//! [0]
int main(int argc, char *argv[])
//! [0] //! [1]
@@ -63,7 +18,7 @@ int main(int argc, char *argv[])
//! [2]
QTranslator translator;
//! [2] //! [3]
- if (translator.load(locale, u"arrowpad"_qs, u"_"_qs))
+ if (translator.load(locale, u"arrowpad"_s, u"_"_s))
app.installTranslator(&translator);
//! [1] //! [3]
diff --git a/examples/linguist/arrowpad/mainwindow.cpp b/examples/linguist/arrowpad/mainwindow.cpp
index 663225c0c..6da16a4a5 100644
--- a/examples/linguist/arrowpad/mainwindow.cpp
+++ b/examples/linguist/arrowpad/mainwindow.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
@@ -62,8 +15,8 @@ MainWindow::MainWindow()
//! [1]
exitAct = new QAction(tr("E&xit"), this);
- exitAct->setShortcuts(QKeySequence::Quit);
- connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
+ exitAct->setShortcut(QKeySequence(tr("Ctrl+Q", "Quit")));
+ connect(exitAct, &QAction::triggered, this, &MainWindow::close);
//! [1]
fileMenu = menuBar()->addMenu(tr("&File"));
diff --git a/examples/linguist/arrowpad/mainwindow.h b/examples/linguist/arrowpad/mainwindow.h
index 271c7f645..0b16d1503 100644
--- a/examples/linguist/arrowpad/mainwindow.h
+++ b/examples/linguist/arrowpad/mainwindow.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
diff --git a/examples/linguist/doc/images/linguist-i18n.png b/examples/linguist/doc/images/linguist-i18n.png
new file mode 100644
index 000000000..20c46c9e6
--- /dev/null
+++ b/examples/linguist/doc/images/linguist-i18n.png
Binary files differ
diff --git a/examples/linguist/doc/snippets/doc_src_examples_arrowpad.cpp b/examples/linguist/doc/snippets/doc_src_examples_arrowpad.cpp
index 38605df52..4d1168109 100644
--- a/examples/linguist/doc/snippets/doc_src_examples_arrowpad.cpp
+++ b/examples/linguist/doc/snippets/doc_src_examples_arrowpad.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
qApp->translate("ArrowPad", x)
diff --git a/examples/linguist/doc/snippets/doc_src_examples_arrowpad.qdoc b/examples/linguist/doc/snippets/doc_src_examples_arrowpad.qdoc
index ddb17bdbe..1d618ef9b 100644
--- a/examples/linguist/doc/snippets/doc_src_examples_arrowpad.qdoc
+++ b/examples/linguist/doc/snippets/doc_src_examples_arrowpad.qdoc
@@ -1,52 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+//! [0]
+lupdate arrowpad.pro
+//! [0]
//! [1]
lrelease arrowpad.pro
@@ -59,6 +16,10 @@ setenv LANG fr
//! [2]
-//! [3]
-set LANG=fr
-//! [3]
+//! [4]
+cmake --build . --target update_translations
+//! [4]
+
+//! [5]
+cmake --build . --target release_translations
+//! [5]
diff --git a/examples/linguist/doc/snippets/doc_src_examples_hellotr.qdoc b/examples/linguist/doc/snippets/doc_src_examples_hellotr.qdoc
index a32a64915..b5f931310 100644
--- a/examples/linguist/doc/snippets/doc_src_examples_hellotr.qdoc
+++ b/examples/linguist/doc/snippets/doc_src_examples_hellotr.qdoc
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
//! [0]
lupdate -verbose hellotr.pro
@@ -79,3 +32,7 @@ linguist hellotr_la.ts
//! [4]
<translation>Orbis, te saluto!</translation>
//! [4]
+
+//! [5]
+cmake --build . --target update_translations
+//! [5]
diff --git a/examples/linguist/doc/snippets/doc_src_examples_trollprint.cpp b/examples/linguist/doc/snippets/doc_src_examples_trollprint.cpp
index 8492f9eb5..667f6745b 100644
--- a/examples/linguist/doc/snippets/doc_src_examples_trollprint.cpp
+++ b/examples/linguist/doc/snippets/doc_src_examples_trollprint.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
twoSidedEnabledRadio = new QRadioButton(tr("Enabled", "two-sided"));
diff --git a/examples/linguist/doc/src/arrowpad.qdoc b/examples/linguist/doc/src/arrowpad.qdoc
index 926aeead9..d4408f77f 100644
--- a/examples/linguist/doc/src/arrowpad.qdoc
+++ b/examples/linguist/doc/src/arrowpad.qdoc
@@ -1,34 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\example arrowpad
- \title Arrow Pad Example
\ingroup examples-linguist
+ \examplecategory {User Interface Components}
+
+ \title Arrow Pad Example
+
\brief Understanding the Qt Linguist \e contexts concept and using two
or more languages.
@@ -36,18 +15,33 @@
We will use two translations, French and Dutch, although there is no
effective limit on the number of possible translations that can be used
- with an application. The relevant lines of \c arrowpad.pro are
+ with an application.
+
+ When using qmake, the relevant lines in \c arrowpad.pro are:
\snippet arrowpad/arrowpad.pro 0
\codeline
\snippet arrowpad/arrowpad.pro 1
- Run \c lupdate; it should produce two identical message files
+ When using CMake, the relevant lines in \c CMakeLists.txt are:
+ \snippet arrowpad/CMakeLists.txt 0
+ \codeline
+ \snippet arrowpad/CMakeLists.txt 1
+
+ Run \c lupdate. It should produce two identical message files
\c arrowpad_fr.ts and \c arrowpad_nl.ts. These files will contain all the source
texts marked for translation with \c tr() calls and their contexts.
+ When using qmake, \c lupdate must be run manually:
+
+ \snippet doc/snippets/doc_src_examples_arrowpad.qdoc 0
+
+ When using CMake, build the \c update_translations target to run \c lupdate:
+
+ \snippet doc/snippets/doc_src_examples_arrowpad.qdoc 4
+
See the \l{Qt Linguist Manual} for more information about
- translating Qt application.
+ translating Qt applications.
\section1 Line by Line Walkthrough
@@ -156,9 +150,10 @@
\endlist
\endlist
- It's quickest to press \uicontrol{Alt+D} (which clicks the \uicontrol {Done \& Next}
- button) after typing each translation, since this marks the
+ The \uicontrol {Done \& Next} button marks the
translation as done and moves on to the next source text.
+ It's quicker to use its short cut (see the Translation menu bar)
+ after typing each translation.
Save the file and do the same for Dutch working with \c arrowpad_nl.ts:
@@ -189,21 +184,24 @@
\snippet doc/snippets/doc_src_examples_arrowpad.qdoc 1
- This should create both \c arrowpad_fr.qm and \c arrowpad_nl.qm. Set the \c
- LANG environment variable to \c fr. In Unix, one of the two following
- commands should work
+ when using CMake, type
- \snippet doc/snippets/doc_src_examples_arrowpad.qdoc 2
+ \snippet doc/snippets/doc_src_examples_arrowpad.qdoc 5
- In Windows, either modify \c autoexec.bat or run
+ This should create both \c arrowpad_fr.qm and \c arrowpad_nl.qm.
+
+ To use \c arrowpad_fr.qm, change your system language to French.
+ In Unix, one of the two following commands should work:
+
+ \snippet doc/snippets/doc_src_examples_arrowpad.qdoc 2
- \snippet doc/snippets/doc_src_examples_arrowpad.qdoc 3
+ In Windows or Mac, set your display language to French.
When you run the program, you should now see the French version:
\image linguist-arrowpad_fr.png
- Try the same with Dutch, by setting \c LANG=nl. Now the Dutch
+ Try the same with Dutch (use \c LANG=nl in Unix). Now the Dutch
version should appear:
\image linguist-arrowpad_nl.png
diff --git a/examples/linguist/doc/src/hellotr.qdoc b/examples/linguist/doc/src/hellotr.qdoc
index 924950731..67de1002e 100644
--- a/examples/linguist/doc/src/hellotr.qdoc
+++ b/examples/linguist/doc/src/hellotr.qdoc
@@ -1,33 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\example hellotr
\ingroup examples-linguist
+ \examplecategory {User Interface Components}
+
\title Hello tr() Example
\brief Translating a small Hello World program to Latin.
@@ -56,6 +34,10 @@
Tries to load a file called \c hellotr_la.qm (the \c .qm file extension is
implicit) that contains Latin translations for the source texts used in
the program. No error will occur if the file is not found.
+ This example works best on desktop platforms.
+ On platforms like Android and iOS,
+ the .qm file needs to be part of the app bundle. Usually,
+ this involves bundling the .qm file in a Qt resource.
\snippet hellotr/main.cpp 7
@@ -82,17 +64,23 @@
\section1 Creating a Latin Message File
- The first step is to create a project file, \c hellotr.pro, that lists
- all the source files for the project. The project file can be a qmake
- project file, or even an ordinary makefile. Any file that contains
+ The first step is to create a project file that lists
+ all the source files for the project.
+
+ When using qmake, the relevant lines in \c hellotr.pro are:
\snippet hellotr/hellotr.pro 0
\snippet hellotr/hellotr.pro 1
- will work. \c TRANSLATIONS specifies the message files we want to
+ \c TRANSLATIONS specifies the message files we want to
maintain. In this example, we just maintain one set of translations,
namely Latin.
+ When using CMake, the relevant lines in \c CMakeLists.txt are:
+ \snippet hellotr/CMakeLists.txt 0
+ \codeline
+ \snippet hellotr/CMakeLists.txt 1
+
Note that the file extension is \c .ts, not \c .qm. The \c .ts
translation source format is designed for use during the
application's development. Programmers or release managers run
@@ -119,16 +107,23 @@
\c lupdate is used to create and update the message files (\c hellotr_la.ts
in this case) to keep them in sync with the source code. It is safe to
run \c lupdate at any time, as \c lupdate does not remove any
- information. For example, you can put it in the makefile, so the TS
- files are updated whenever the source changes.
+ information.
+
+ Try running \c lupdate right now.
- Try running \c lupdate right now, like this:
+ When using qmake, \c lupdate must be run manually:
\snippet doc/snippets/doc_src_examples_hellotr.qdoc 0
(The \c -verbose option instructs \c lupdate to display messages that
- explain what it is doing.) You should now have a file \c hellotr_la.ts in
- the current directory, containing this:
+ explain what it is doing.)
+
+ When using CMake, build the \c update_translations target to run \c lupdate:
+
+ \snippet doc/snippets/doc_src_examples_hellotr.qdoc 5
+
+ You should now have a file \c hellotr_la.ts in
+ the source directory, containing this:
\snippet doc/snippets/doc_src_examples_hellotr.qdoc 1
diff --git a/examples/linguist/doc/src/i18n.qdoc b/examples/linguist/doc/src/i18n.qdoc
new file mode 100644
index 000000000..a356b09d0
--- /dev/null
+++ b/examples/linguist/doc/src/i18n.qdoc
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \example i18n
+ \ingroup examples-linguist
+ \examplecategory {User Interface Components}
+
+ \title I18N Example
+
+ \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/doc/src/trollprint.qdoc b/examples/linguist/doc/src/trollprint.qdoc
index 0228936e4..ffbd57fb8 100644
--- a/examples/linguist/doc/src/trollprint.qdoc
+++ b/examples/linguist/doc/src/trollprint.qdoc
@@ -1,33 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\example trollprint
\ingroup examples-linguist
+ \examplecategory {User Interface Components}
+
\title Troll Print Example
\brief Updating translations for later releases.
@@ -142,8 +120,8 @@
\snippet doc/snippets/doc_src_examples_trollprint.cpp 1
- Now run \c lupdate and open \c trollprint_pt.ts with \e {Qt Linguist}. You
- should now see two changes.
+ Now recompile, run \c lupdate and open \c trollprint_pt.ts with
+ \e {Qt Linguist}. You should now see two changes.
First, the translation source file now contains \e three "Enabled",
"Disabled" pairs. The first pair is marked "(obs.)" signifying that they
@@ -217,20 +195,6 @@
Linguist}. The following items are of special interest:
\list
- \li \c MainWindow
- \list
- \li Troll Print 1.0 - marked "(obs.)", obsolete
- \li About Troll Print 1.0 - marked "(obs.)", obsolete
- \li Troll Print 1.0. Copyright 1999 Software, Inc. -
- marked obsolete
- \li Troll Print 1.1 - automatically translated as
- "Troll Imprimir 1.1"
- \li About Troll Print 1.1 - automatically translated as
- "Troll Imprimir 1.1"
- \li Troll Print 1.1. Copyright 1999-2000 Software,
- Inc. - automatically translated as "Troll Imprimir 1.1.
- Copyright 1999-2000 Software, Inc."
- \endlist
\li \c PrintPanel
\list
\li 2-sided - marked "(obs.)", obsolete
@@ -239,8 +203,9 @@
\endlist
\endlist
- Notice that \c lupdate works hard behind the scenes to make revisions
- easier, and it's pretty smart with numbers.
+ In order to make revisions easier, instead of tr("Troll Print 1.0")
+ you can use tr("Troll Print %1").arg("1.0") or such to avoid having to update
+ the string on every release.
Go over the translations in \c MainWindow and mark these as "done".
Translate "\<b\>TROLL PRINT\</b\>" as "\<b\>TROLL IMPRIMIR\</b\>".
diff --git a/examples/linguist/hellotr/CMakeLists.txt b/examples/linguist/hellotr/CMakeLists.txt
index 74cb0e05a..0fff68ad5 100644
--- a/examples/linguist/hellotr/CMakeLists.txt
+++ b/examples/linguist/hellotr/CMakeLists.txt
@@ -1,31 +1,37 @@
-# Generated from hellotr.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(hellotr LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/linguist/hellotr")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+#! [0]
+find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
+
+qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES la)
+#! [0]
qt_add_executable(hellotr
main.cpp
)
+
+#! [1]
+qt6_add_translations(hellotr
+ QM_FILES_OUTPUT_VARIABLE qm_files)
+install(FILES ${qm_files} DESTINATION ${INSTALL_EXAMPLEDIR})
+#! [1]
set_target_properties(hellotr PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(hellotr PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/linguist/hellotr/hellotr_la.ts b/examples/linguist/hellotr/hellotr_la.ts
new file mode 100644
index 000000000..1f068c5de
--- /dev/null
+++ b/examples/linguist/hellotr/hellotr_la.ts
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS/>
diff --git a/examples/linguist/hellotr/main.cpp b/examples/linguist/hellotr/main.cpp
index 24206f093..e655029fb 100644
--- a/examples/linguist/hellotr/main.cpp
+++ b/examples/linguist/hellotr/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QApplication>
#include <QPushButton>
@@ -64,8 +17,7 @@ int main(int argc, char *argv[])
//! [5]
QTranslator translator;
//! [5] //! [6]
- if (!translator.load("hellotr_la"))
- return 1;
+ Q_UNUSED(translator.load("hellotr_la"));
//! [6] //! [7]
app.installTranslator(&translator);
//! [4] //! [7]
diff --git a/examples/linguist/i18n/CMakeLists.txt b/examples/linguist/i18n/CMakeLists.txt
new file mode 100644
index 000000000..d412177c3
--- /dev/null
+++ b/examples/linguist/i18n/CMakeLists.txt
@@ -0,0 +1,46 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR 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_standard_project_setup(
+ I18N_TRANSLATED_LANGUAGES ar cs de el en eo fr it ja ko nb ru sv zh
+)
+
+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_FILE_DIR translations
+)
+
+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..a8558cb60
--- /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 &qmFile = qmFiles.at(i);
+ QCheckBox *checkBox = new QCheckBox(languageName(qmFile));
+ qmFileForCheckBoxMap.insert(checkBox, qmFile);
+ connect(checkBox, &QCheckBox::toggled, this, &LanguageChooser::checkBoxToggled);
+ if (std::find_if(
+ uiLanguages.begin(), uiLanguages.end(),
+ [qmFile](const QString &lang) -> bool { return languageMatch(lang, qmFile); })
+ != 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&amp;xit</source>
+ <translation>أخرج</translation>
+ </message>
+ <message>
+ <source>&amp;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>&amp;File</source>
+ <translation>&amp;Soubor</translation>
+ </message>
+ <message>
+ <source>E&amp;xit</source>
+ <translation>&amp;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>&amp;File</source>
+ <translation>&amp;Datei</translation>
+ </message>
+ <message>
+ <source>E&amp;xit</source>
+ <translation>Be&amp;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>&amp;File</source>
+ <translation>&amp;Αρχείο</translation>
+ </message>
+ <message>
+ <source>E&amp;xit</source>
+ <translation>Έ&amp;ξοδος</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&amp;xit</source>
+ <translation>E&amp;xit</translation>
+ </message>
+ <message>
+ <source>&amp;File</source>
+ <translation>&amp;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>&amp;File</source>
+ <translation>&amp;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&amp;xit</source>
+ <translation>&amp;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>&amp;File</source>
+ <translation>&amp;Fichier</translation>
+ </message>
+ <message>
+ <source>E&amp;xit</source>
+ <translation>&amp;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&apos;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&amp;xit</source>
+ <translation>&amp;Esci</translation>
+ </message>
+ <message>
+ <source>&amp;File</source>
+ <translation>&amp;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>&amp;File</source>
+ <translation>ファイル(&amp;F)</translation>
+ </message>
+ <message>
+ <source>E&amp;xit</source>
+ <translation>終了(&amp;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>&amp;File</source>
+ <translation>파일&amp;F</translation>
+ </message>
+ <message>
+ <source>E&amp;xit</source>
+ <translation>종료&amp;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>&amp;File</source>
+ <translation>&amp;Fil</translation>
+ </message>
+ <message>
+ <source>E&amp;xit</source>
+ <translation>&amp;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>&amp;File</source>
+ <translation>Файл</translation>
+ </message>
+ <message>
+ <source>E&amp;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>&amp;File</source>
+ <translation>&amp;Arkiv</translation>
+ </message>
+ <message>
+ <source>E&amp;xit</source>
+ <translation>&amp;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>&amp;File</source>
+ <translation>文件[&amp;F]</translation>
+ </message>
+ <message>
+ <source>E&amp;xit</source>
+ <translation>退出[&amp;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
diff --git a/examples/linguist/trollprint/CMakeLists.txt b/examples/linguist/trollprint/CMakeLists.txt
index bb378111f..8ced26c90 100644
--- a/examples/linguist/trollprint/CMakeLists.txt
+++ b/examples/linguist/trollprint/CMakeLists.txt
@@ -1,33 +1,36 @@
-# Generated from trollprint.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(trollprint LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/linguist/trollprint")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
+
+qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES pt)
qt_add_executable(trollprint
main.cpp
mainwindow.cpp mainwindow.h
printpanel.cpp printpanel.h
)
+
+qt6_add_translations(trollprint
+ QM_FILES_OUTPUT_VARIABLE qm_files)
+install(FILES ${qm_files} DESTINATION ${INSTALL_EXAMPLEDIR})
+
set_target_properties(trollprint PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(trollprint PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/linguist/trollprint/main.cpp b/examples/linguist/trollprint/main.cpp
index e334a2bc5..6d7b35ba5 100644
--- a/examples/linguist/trollprint/main.cpp
+++ b/examples/linguist/trollprint/main.cpp
@@ -1,57 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
#include "mainwindow.h"
+using namespace Qt::StringLiterals;
+
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
@@ -60,7 +15,7 @@ int main(int argc, char *argv[])
//! [0]
QTranslator translator;
- if (translator.load(locale, u"trollprint"_qs, u"_"_qs))
+ if (translator.load(locale, u"trollprint"_s, u"_"_s))
app.installTranslator(&translator);
//! [0]
diff --git a/examples/linguist/trollprint/mainwindow.cpp b/examples/linguist/trollprint/mainwindow.cpp
index 64461acec..b0a411dc5 100644
--- a/examples/linguist/trollprint/mainwindow.cpp
+++ b/examples/linguist/trollprint/mainwindow.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
@@ -62,15 +15,15 @@ MainWindow::MainWindow()
createMenus();
//! [0]
- setWindowTitle(tr("Troll Print 1.0"));
+ setWindowTitle(tr("Troll Print %1").arg("1.0"));
//! [0]
}
void MainWindow::about()
{
- QMessageBox::information(this, tr("About Troll Print 1.0"),
- tr("Troll Print 1.0.\n\n"
- "Copyright 1999 Software, Inc."));
+ QMessageBox::information(this, tr("About Troll Print %1").arg("1.0"),
+ tr("Troll Print %1.\n\n"
+ "Copyright 1999 Software, Inc.").arg("1.0"));
}
//! [1]
@@ -80,14 +33,14 @@ void MainWindow::createActions()
exitAct = new QAction(tr("E&xit"), this);
exitAct->setShortcut(tr("Ctrl+Q", "Quit"));
//! [2]
- connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
+ connect(exitAct, &QAction::triggered, this, &MainWindow::close);
aboutAct = new QAction(tr("&About"), this);
aboutAct->setShortcut(Qt::Key_F1);
- connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
+ connect(aboutAct, &QAction::triggered, this, &MainWindow::about);
aboutQtAct = new QAction(tr("About &Qt"), this);
- connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+ connect(aboutQtAct, &QAction::triggered, qApp, &QApplication::aboutQt);
}
void MainWindow::createMenus()
diff --git a/examples/linguist/trollprint/mainwindow.h b/examples/linguist/trollprint/mainwindow.h
index 178113179..ed2d7b69e 100644
--- a/examples/linguist/trollprint/mainwindow.h
+++ b/examples/linguist/trollprint/mainwindow.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
diff --git a/examples/linguist/trollprint/printpanel.cpp b/examples/linguist/trollprint/printpanel.cpp
index adfd683be..1d0c30c4c 100644
--- a/examples/linguist/trollprint/printpanel.cpp
+++ b/examples/linguist/trollprint/printpanel.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
diff --git a/examples/linguist/trollprint/printpanel.h b/examples/linguist/trollprint/printpanel.h
index 97edcafb4..9a075dca6 100644
--- a/examples/linguist/trollprint/printpanel.h
+++ b/examples/linguist/trollprint/printpanel.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef PRINTPANEL_H
#define PRINTPANEL_H
diff --git a/examples/linguist/trollprint/trollprint_pt.ts b/examples/linguist/trollprint/trollprint_pt.ts
index e5871bd08..b8e215c51 100644
--- a/examples/linguist/trollprint/trollprint_pt.ts
+++ b/examples/linguist/trollprint/trollprint_pt.ts
@@ -1,9 +1,11 @@
-<!DOCTYPE TS><TS>
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="pt">
<context>
<name>MainWindow</name>
<message>
- <source>Troll Print 1.0</source>
- <translation>Troll Imprimir 1.0</translation>
+ <source>Troll Print %1</source>
+ <translation>Troll Imprimir %1</translation>
</message>
<message>
<source>E&amp;xit</source>
@@ -26,14 +28,14 @@
<translation>A&amp;juda</translation>
</message>
<message>
- <source>About Troll Print 1.0</source>
- <translation>Sobre Troll Imprimir 1.0</translation>
+ <source>About Troll Print %1</source>
+ <translation>Sobre Troll Imprimir %1</translation>
</message>
<message>
- <source>Troll Print 1.0.
+ <source>Troll Print %1.
Copyright 1999 Software, Inc.</source>
- <translation>Troll Imprimir 1.0
+ <translation>Troll Imprimir %1
Copyright 1999 Software, Inc.</translation>
</message>