diff --git a/crowdin.yml b/crowdin.yml index b8fd7a00..3f426891 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -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 diff --git a/src/gui-qml/CMakeLists.txt b/src/gui-qml/CMakeLists.txt index d9c59015..872f30d5 100644 --- a/src/gui-qml/CMakeLists.txt +++ b/src/gui-qml/CMakeLists.txt @@ -1,6 +1,7 @@ # General project(gui-qml) add_definitions(-DGUI=1) +add_subdirectory(languages) # Qt libraries find_package(Qt5Core REQUIRED) diff --git a/src/gui-qml/languages/CMakeLists.txt b/src/gui-qml/languages/CMakeLists.txt new file mode 100644 index 00000000..ba31cd94 --- /dev/null +++ b/src/gui-qml/languages/CMakeLists.txt @@ -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}) diff --git a/src/gui-qml/languages/YourLanguage.ts b/src/gui-qml/languages/YourLanguage.ts new file mode 100644 index 00000000..cd2ee621 --- /dev/null +++ b/src/gui-qml/languages/YourLanguage.ts @@ -0,0 +1,124 @@ + + + + + AddSourceScreen + + Add new source + + + + Error + + + + Type + + + + URL + + + + HTTPS + + + + Add + + + + + FolderSetting + + Please choose a directory + + + + + ImageScreen + + Image + + + + + LogScreen + + Log + + + + + MainDrawer + + Search + + + + Favorites + + + + Log + + + + Settings + + + + + SearchScreen + + Search + + + + Search... + + + + Sources + + + + Go + + + + + SettingsScreen + + Settings + + + + Save + + + + Filename + + + + Folder + + + + Hide blacklisted + + + + Hide blacklisted images from the results. + + + + + SourcesScreen + + Sources selection + + + + diff --git a/src/gui-qml/src/components/AddSourceScreen.qml b/src/gui-qml/src/components/AddSourceScreen.qml index 8d745088..85b6585e 100644 --- a/src/gui-qml/src/components/AddSourceScreen.qml +++ b/src/gui-qml/src/components/AddSourceScreen.qml @@ -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) diff --git a/src/gui-qml/src/components/ImageScreen.qml b/src/gui-qml/src/components/ImageScreen.qml index 33a455fb..7801d964 100644 --- a/src/gui-qml/src/components/ImageScreen.qml +++ b/src/gui-qml/src/components/ImageScreen.qml @@ -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 diff --git a/src/gui-qml/src/components/LogScreen.qml b/src/gui-qml/src/components/LogScreen.qml index cd76ac57..11ef49c7 100644 --- a/src/gui-qml/src/components/LogScreen.qml +++ b/src/gui-qml/src/components/LogScreen.qml @@ -15,7 +15,7 @@ Page { } Label { - text: "Log" + text: qsTr("Log") elide: Label.ElideRight horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter diff --git a/src/gui-qml/src/components/SearchScreen.qml b/src/gui-qml/src/components/SearchScreen.qml index 254d67f3..1554c0b6 100644 --- a/src/gui-qml/src/components/SearchScreen.qml +++ b/src/gui-qml/src/components/SearchScreen.qml @@ -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 diff --git a/src/gui-qml/src/components/SourcesScreen.qml b/src/gui-qml/src/components/SourcesScreen.qml index 7362149e..bf94e319 100644 --- a/src/gui-qml/src/components/SourcesScreen.qml +++ b/src/gui-qml/src/components/SourcesScreen.qml @@ -22,7 +22,7 @@ Page { } Label { - text: "Sources selection" + text: qsTr("Sources selection") elide: Label.ElideRight horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter diff --git a/src/gui-qml/src/components/settings/FolderSetting.qml b/src/gui-qml/src/components/settings/FolderSetting.qml index 61687029..03ebc39e 100644 --- a/src/gui-qml/src/components/settings/FolderSetting.qml +++ b/src/gui-qml/src/components/settings/FolderSetting.qml @@ -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 diff --git a/src/gui-qml/src/components/settings/SettingsScreen.qml b/src/gui-qml/src/components/settings/SettingsScreen.qml index 688a14d5..e03760f4 100644 --- a/src/gui-qml/src/components/settings/SettingsScreen.qml +++ b/src/gui-qml/src/components/settings/SettingsScreen.qml @@ -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