Add QML translations

This commit is contained in:
Bionus 2020-10-24 00:29:51 +02:00
parent 373654dd08
commit f541641441
No known key found for this signature in database
GPG Key ID: 54B0B2DE713AE915
11 changed files with 164 additions and 20 deletions

View File

@ -3,3 +3,5 @@ files:
translation: /src/languages/%language%.ts
- source: /src/crash-reporter/languages/YourLanguage.ts
translation: /src/crash-reporter/languages/%language%.ts
- source: /src/gui-qml/languages/YourLanguage.ts
translation: /src/gui-qml/languages/%language%.ts

View File

@ -1,6 +1,7 @@
# General
project(gui-qml)
add_definitions(-DGUI=1)
add_subdirectory(languages)
# Qt libraries
find_package(Qt5Core REQUIRED)

View File

@ -0,0 +1,17 @@
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1) # Don't delete TS files
find_package(Qt5LinguistTools)
# Get two separate lists of TS files: one with only 'YourLanguage', and another with all other translations
set(TS_FILES_FOR_TS "${CMAKE_CURRENT_SOURCE_DIR}/YourLanguage.ts")
file(GLOB TS_FILES_FOR_QM "*.ts")
include(ListFilterRegex)
listFilterRegex(TS_FILES_FOR_QM "YourLanguage.ts$")
# Source files (used for 'location' and 'context' in TS files)
file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_LIST_DIR}/../src/")
qt5_create_translation(QM_FILES_FOR_TS ${SOURCES} ${TS_FILES_FOR_TS}) # Re-generate TS and generate QM for 'YourLanguage'
qt5_add_translation(QM_FILES ${TS_FILES_FOR_QM}) # Only generate QM for actual translations
add_custom_target("gui-qml_translations" ALL DEPENDS ${TS_FILES_FOR_TS} ${QM_FILES_FOR_TS} ${QM_FILES})

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AddSourceScreen</name>
<message>
<source>Add new source</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Type</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>URL</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>HTTPS</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FolderSetting</name>
<message>
<source>Please choose a directory</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImageScreen</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LogScreen</name>
<message>
<source>Log</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainDrawer</name>
<message>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Favorites</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SearchScreen</name>
<message>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Search...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sources</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Go</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsScreen</name>
<message>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Filename</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide blacklisted</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide blacklisted images from the results.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SourcesScreen</name>
<message>
<source>Sources selection</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -21,7 +21,7 @@ Page {
}
Label {
text: "Add new source"
text: qsTr("Add new source")
elide: Label.ElideRight
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
@ -32,7 +32,7 @@ Page {
MessageDialog {
id: errorDialog
title: "Error"
title: qsTr("Error")
icon: StandardIcon.Critical
}
@ -41,7 +41,7 @@ Page {
Text {
Layout.fillWidth: true
text: "Type"
text: qsTr("Type")
}
ComboBox {
id: typeField
@ -51,7 +51,7 @@ Page {
Text {
Layout.fillWidth: true
text: "URL"
text: qsTr("URL")
}
TextField {
id: urlField
@ -61,7 +61,7 @@ Page {
CheckBox {
id: httpsField
Layout.fillWidth: true
text: "HTTPS"
text: qsTr("HTTPS")
checked: true
}
@ -72,7 +72,7 @@ Page {
footer: Button {
Layout.fillWidth: true
text: "Add"
text: qsTr("Add")
onClicked: {
var result = backend.addSite(typeField.currentText, urlField.text, httpsField.checked)

View File

@ -23,7 +23,7 @@ Page {
}
Label {
text: "Image" // TODO: add more info about the image
text: qsTr("Image") // TODO: add more info about the image
elide: Label.ElideRight
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter

View File

@ -15,7 +15,7 @@ Page {
}
Label {
text: "Log"
text: qsTr("Log")
elide: Label.ElideRight
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter

View File

@ -32,7 +32,7 @@ Page {
}
Label {
text: "Search"
text: qsTr("Search")
elide: Label.ElideRight
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
@ -119,13 +119,13 @@ Page {
id: textFieldSearch
text: "rating:safe wallpaper"
placeholderText: "Search..."
placeholderText: qsTr("Search...")
onEnterPressed: searchTab.load()
}
Button {
text: "Sources"
text: qsTr("Sources")
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.rightMargin: 40
@ -138,7 +138,7 @@ Page {
Button {
id: searchButton
width: 40
text: "Go"
text: qsTr("Go")
anchors.right: parent.right
anchors.top: parent.top

View File

@ -22,7 +22,7 @@ Page {
}
Label {
text: "Sources selection"
text: qsTr("Sources selection")
elide: Label.ElideRight
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter

View File

@ -28,7 +28,7 @@ Item {
id: dialog
// acceptLabel: "Select"
title: "Please choose a directory"
title: qsTr("Please choose a directory")
folder: "file:///" + setting.value
// selectExisting: true
selectFolder: true

View File

@ -23,7 +23,7 @@ Page {
}
Label {
text: "Settings"
text: qsTr("Settings")
elide: Label.ElideRight
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
@ -37,14 +37,14 @@ Page {
Text {
Layout.fillWidth: true
text: "Save"
text: qsTr("Save")
font.bold: true
}
TextFieldSetting {
id: filenameSetting
name: "Filename"
name: qsTr("Filename")
settingKey: "Save/filename"
settingDefault: "%md5%.%ext%"
Layout.fillWidth: true
@ -53,15 +53,15 @@ Page {
FolderSetting {
id: folderSetting
name: "Folder"
name: qsTr("Folder")
settingKey: "Save/path"
settingDefault: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
Layout.fillWidth: true
}
CheckBoxSetting {
name: "Hide blacklisted"
subtitle: "Hide blacklisted images from the results."
name: qsTr("Hide blacklisted")
subtitle: qsTr("Hide blacklisted images from the results.")
settingKey: "hideblacklisted"
settingDefault: true
Layout.fillWidth: true