Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
public-demos
qtdesign-studio
Commits
f72e5dfe
Commit
f72e5dfe
authored
Nov 16, 2021
by
Thomas Hartmann
Browse files
Add test for multilanguage database
parent
56e41d48
Changes
20
Hide whitespace changes
Inline
Side-by-side
playground/TranslationTest/CMakeLists.txt
0 → 100644
View file @
f72e5dfe
cmake_minimum_required
(
VERSION 3.18
)
project
(
TranslationTest LANGUAGES CXX
)
set
(
CMAKE_INCLUDE_CURRENT_DIR ON
)
set
(
CMAKE_AUTOMOC ON
)
find_package
(
Qt6 COMPONENTS Gui Qml Quick
)
add_executable
(
TranslationTestApp src/main.cpp
)
target_link_libraries
(
TranslationTestApp PRIVATE
Qt
${
QT_VERSION_MAJOR
}
::Core
Qt
${
QT_VERSION_MAJOR
}
::Gui
Qt
${
QT_VERSION_MAJOR
}
::Quick
Qt
${
QT_VERSION_MAJOR
}
::Qml
)
include
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/qmlmodules
)
playground/TranslationTest/TranslationTest.qmlproject
0 → 100644
View file @
f72e5dfe
import QmlProject
Project {
mainFile: "content/App.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
Files {
filter: "*.conf"
files: ["qtquickcontrols2.conf"]
}
Files {
filter: "qmldir"
directory: "."
}
Files {
filter: "*.ttf;*.otf"
}
Environment {
QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf"
QT_AUTO_SCREEN_SCALE_FACTOR: "1"
}
qt6Project: true
/* List of plugin directories passed to QML runtime */
importPaths: [ ".", "imports" ]
/* Required for deployment */
targetDirectory: "/opt/TranslationTest"
supportedLanguages: ["ar","en","fr","de","hi","fa","ru","es"]
primaryLanguage: "en"
}
playground/TranslationTest/content/App.qml
0 → 100644
View file @
f72e5dfe
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Quick Studio Components.
**
** $QT_BEGIN_LICENSE:GPL$
** 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 General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import
QtQuick
import
QtQuick
.
Window
import
TranslationTest
Window
{
width
:
Constants
.
width
height
:
Constants
.
height
visible
:
true
title
:
"
TranslationTest
"
Screen01
{
}
}
playground/TranslationTest/content/CMakeLists.txt
0 → 100644
View file @
f72e5dfe
### This file is automatically generated by Qt Design Studio.
### Do not change
qt_add_library
(
content STATIC
)
qt6_add_qml_module
(
content
URI
"content"
VERSION 1.0
QML_FILES
App.qml
Screen01.ui.qml
RESOURCES
fonts/fonts.txt
)
playground/TranslationTest/content/Screen01.ui.qml
0 → 100644
View file @
f72e5dfe
import
QtQuick
import
QtQuick
.
Controls
import
TranslationTest
Rectangle
{
width
:
Constants
.
width
height
:
Constants
.
height
color
:
Constants
.
backgroundColor
Column
{
x
:
0
y
:
0
Text
{
text
:
qsTrId
(
"
translationId01_network
"
)
font.pointSize
:
24
}
Text
{
text
:
qsTrId
(
"
translationId02_month
"
)
font.pointSize
:
24
}
Text
{
text
:
qsTrId
(
"
translationId03_year
"
)
font.pointSize
:
24
}
Text
{
width
:
240
text
:
qsTrId
(
"
translationId04_user_defined
"
)
font.pointSize
:
24
}
Text
{
text
:
qsTrId
(
"
translationId05_setup
"
)
font.pointSize
:
24
}
Text
{
text
:
qsTrId
(
"
translationId06_reset
"
)
font.pointSize
:
24
}
Text
{
text
:
qsTrId
(
"
translationId07_information
"
)
font.pointSize
:
24
}
Text
{
text
:
qsTrId
(
"
translationId08_missing
"
)
font.pointSize
:
24
}
}
Text
{
x
:
452
y
:
132
text
:
"
elided
"
font.bold
:
true
font.pointSize
:
24
}
Text
{
x
:
452
y
:
301
text
:
"
missing
"
font.pointSize
:
24
font.bold
:
true
}
}
/*##^##
Designer {
D{i:0;formeditorZoom:0.5}D{i:2}D{i:3}D{i:4}D{i:5}D{i:6}D{i:7}D{i:8}D{i:9}D{i:10}D{i:11}
}
##^##*/
playground/TranslationTest/content/fonts/fonts.txt
0 → 100644
View file @
f72e5dfe
Fonts in this folder are loaded automatically.
playground/TranslationTest/content/translations.json
0 → 100644
View file @
f72e5dfe
{
"translatables"
:
[
{
"trId"
:
"translationId01_network"
,
"translations"
:
[
{
"language"
:
"ar"
,
"translation"
:
"شبكة الاتصال"
},
{
"language"
:
"de"
,
"translation"
:
"Netzwerk"
},
{
"language"
:
"en"
,
"translation"
:
"Network"
},
{
"language"
:
"es"
,
"translation"
:
"La red"
},
{
"language"
:
"fa"
,
"translation"
:
"شبکه"
},
{
"language"
:
"fr"
,
"translation"
:
"Réseau"
},
{
"language"
:
"hi"
,
"translation"
:
"नेटवर्क"
},
{
"language"
:
"ru"
,
"translation"
:
"Сеть"
}
]
},
{
"trId"
:
"translationId02_month"
,
"translations"
:
[
{
"language"
:
"ar"
,
"translation"
:
"الشهر"
},
{
"language"
:
"de"
,
"translation"
:
"Monat"
},
{
"language"
:
"en"
,
"translation"
:
"Month"
},
{
"language"
:
"es"
,
"translation"
:
"Mes"
},
{
"language"
:
"fa"
,
"translation"
:
"الشهر"
},
{
"language"
:
"fr"
,
"translation"
:
"Mois"
},
{
"language"
:
"hi"
,
"translation"
:
"माह"
},
{
"language"
:
"ru"
,
"translation"
:
"Месяц"
}
]
},
{
"trId"
:
"translationId03_year"
,
"translations"
:
[
{
"language"
:
"ar"
,
"translation"
:
"السنة"
},
{
"language"
:
"de"
,
"translation"
:
"Jahr"
},
{
"language"
:
"en"
,
"translation"
:
"Year"
},
{
"language"
:
"es"
,
"translation"
:
"Ano"
},
{
"language"
:
"fa"
,
"translation"
:
"سال"
},
{
"language"
:
"fr"
,
"translation"
:
"Année"
},
{
"language"
:
"hi"
,
"translation"
:
"माह"
},
{
"language"
:
"ru"
,
"translation"
:
"Год"
}
]
},
{
"trId"
:
"translationId04_user_defined"
,
"translations"
:
[
{
"language"
:
"ar"
,
"translation"
:
"تعريف المستخدم"
},
{
"language"
:
"de"
,
"translation"
:
"Nutzer Definiert"
},
{
"language"
:
"en"
,
"translation"
:
"User Defined"
},
{
"language"
:
"es"
,
"translation"
:
"Definida por el usuario"
},
{
"language"
:
"fa"
,
"translation"
:
"تعریف شده توسط کاربر"
},
{
"language"
:
"fr"
,
"translation"
:
"Défini par l'utilisateur"
},
{
"language"
:
"hi"
,
"translation"
:
"उपयोगकर्ता परिभाषित"
},
{
"language"
:
"ru"
,
"translation"
:
"Определяемые пользователем"
}
]
},
{
"trId"
:
"translationId05_setup"
,
"translations"
:
[
{
"language"
:
"ar"
,
"translation"
:
"الإعدادات"
},
{
"language"
:
"de"
,
"translation"
:
"Einstellungen"
},
{
"language"
:
"en"
,
"translation"
:
"Setup"
},
{
"language"
:
"es"
,
"translation"
:
"Configuración"
},
{
"language"
:
"fa"
,
"translation"
:
"تنظیمات"
},
{
"language"
:
"fr"
,
"translation"
:
"Configuration"
},
{
"language"
:
"hi"
,
"translation"
:
"सेटिंग्स"
},
{
"language"
:
"ru"
,
"translation"
:
"Настройки"
}
]
},
{
"trId"
:
"translationId06_reset"
,
"translations"
:
[
{
"language"
:
"ar"
,
"translation"
:
"افتراضي"
},
{
"language"
:
"de"
,
"translation"
:
"Standard"
},
{
"language"
:
"en"
,
"translation"
:
"Reset"
},
{
"language"
:
"es"
,
"translation"
:
"Restaurar"
},
{
"language"
:
"fa"
,
"translation"
:
"پیشفرض"
},
{
"language"
:
"fr"
,
"translation"
:
"Réinitialiser"
},
{
"language"
:
"hi"
,
"translation"
:
"रीसेट करें"
},
{
"language"
:
"ru"
,
"translation"
:
"По умолчанию"
}
]
},
{
"trId"
:
"translationId07_information"
,
"translations"
:
[
{
"language"
:
"ar"
,
"translation"
:
"المعلومات"
},
{
"language"
:
"de"
,
"translation"
:
"Information"
},
{
"language"
:
"en"
,
"translation"
:
"Information"
},
{
"language"
:
"es"
,
"translation"
:
"Información"
},
{
"language"
:
"fa"
,
"translation"
:
"اطلاعات"
},
{
"language"
:
"fr"
,
"translation"
:
"Information"
},
{
"language"
:
"hi"
,
"translation"
:
"सूचना"
},
{
"language"
:
"ru"
,
"translation"
:
"Информация"
}
]
},
{
"trId"
:
"translationId08_missing"
,
"translations"
:
[
{
"language"
:
"en"
,
"translation"
:
"Missing translations"
}
]
}
]
}
playground/TranslationTest/imports/CMakeLists.txt
0 → 100644
View file @
f72e5dfe
### This file is automatically generated by Qt Design Studio.
### Do not change
add_subdirectory
(
TranslationTest
)
playground/TranslationTest/imports/TranslationTest/CMakeLists.txt
0 → 100644
View file @
f72e5dfe
### This file is automatically generated by Qt Design Studio.
### Do not change
qt_add_library
(
TranslationTest STATIC
)
set_source_files_properties
(
Constants.qml
PROPERTIES
QT_QML_SINGLETON_TYPE true
)
qt6_add_qml_module
(
TranslationTest
URI
"TranslationTest"
VERSION 1.0
QML_FILES
Constants.qml
DirectoryFontLoader.qml
EventListModel.qml
EventListSimulator.qml
)
playground/TranslationTest/imports/TranslationTest/Constants.qml
0 → 100644
View file @
f72e5dfe
pragma
Singleton
import
QtQuick
QtObject
{
readonly
property
int
width
:
1080
readonly
property
int
height
:
1920
property
alias
fontDirectory
:
directoryFontLoader
.
fontDirectory
property
alias
relativeFontDirectory
:
directoryFontLoader
.
relativeFontDirectory
/* Edit this comment to add your custom font */
readonly
property
font
font
:
Qt
.
font
({
family
:
Qt
.
application
.
font
.
family
,
pixelSize
:
Qt
.
application
.
font
.
pixelSize
})
readonly
property
font
largeFont
:
Qt
.
font
({
family
:
Qt
.
application
.
font
.
family
,
pixelSize
:
Qt
.
application
.
font
.
pixelSize
*
1.6
})
readonly
property
color
backgroundColor
:
"
#c2c2c2
"
property
DirectoryFontLoader
directoryFontLoader
:
DirectoryFontLoader
{
id
:
directoryFontLoader
}
}
playground/TranslationTest/imports/TranslationTest/DirectoryFontLoader.qml
0 → 100644
View file @
f72e5dfe
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Quick Designer Components.
**
** $QT_BEGIN_LICENSE:GPL$
** 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 General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import
QtQuick
import
Qt
.
labs
.
folderlistmodel
QtObject
{
id
:
loader
property
url
fontDirectory
:
Qt
.
resolvedUrl
(
"
../../
"
+
relativeFontDirectory
)
property
string
relativeFontDirectory
:
"
fonts
"
function
loadFont
(
url
)
{
var
fontLoader
=
Qt
.
createQmlObject
(
'
import QtQuick 2.15; FontLoader { source: "
'
+
url
+
'
"; }
'
,
loader
,
"
dynamicFontLoader
"
);
}
property
FolderListModel
folderModel
:
FolderListModel
{
id
:
folderModel
folder
:
loader
.
fontDirectory
nameFilters
:
[
"
*.ttf
"
,
"
*.otf
"
]
showDirs
:
false
onStatusChanged
:
{
if
(
folderModel
.
status
==
FolderListModel
.
Ready
)
{
var
i
for
(
i
=
0
;
i
<
count
;
i
++
)
{
loadFont
(
folderModel
.
get
(
i
,
"
fileURL
"
))
}
}
}
}
}
playground/TranslationTest/imports/TranslationTest/EventListModel.qml
0 → 100644
View file @
f72e5dfe
/****************************************************************************
**