Quickshell qstr seems not to be working, trying to implement custom translation

Add Chinese (zh_CN) translations for Quickshell interface and settings
This commit is contained in:
月月
2025-06-17 12:29:21 +08:00
parent 54dfad1d5b
commit b32734b9f5
50 changed files with 1324 additions and 187 deletions
@@ -153,7 +153,7 @@ Button {
MenuButton {
id: openFileLinkButton
Layout.fillWidth: true
buttonText: qsTr("Open file link")
buttonText: Translation.tr("Open file link")
onClicked: {
root.showActions = false
Hyprland.dispatch("keyword cursor:no_warps true")
@@ -165,7 +165,7 @@ Button {
id: sourceButton
visible: root.imageData.source && root.imageData.source.length > 0
Layout.fillWidth: true
buttonText: StringUtils.format(qsTr("Go to source ({0})"), StringUtils.getDomain(root.imageData.source))
buttonText: StringUtils.format(Translation.tr("Go to source ({0})"), StringUtils.getDomain(root.imageData.source))
enabled: root.imageData.source && root.imageData.source.length > 0
onClicked: {
root.showActions = false
@@ -177,10 +177,10 @@ Button {
MenuButton {
id: downloadButton
Layout.fillWidth: true
buttonText: qsTr("Download")
buttonText: Translation.tr("Download")
onClicked: {
root.showActions = false
Hyprland.dispatch(`exec curl '${root.imageData.file_url}' -o '${root.imageData.is_nsfw ? root.nsfwPath : root.downloadPath}/${root.fileName}' && notify-send '${qsTr("Download complete")}' '${root.downloadPath}/${root.fileName}' -a 'Shell'`)
Hyprland.dispatch(`exec curl '${root.imageData.file_url}' -o '${root.imageData.is_nsfw ? root.nsfwPath : root.downloadPath}/${root.fileName}' && notify-send '${Translation.tr("Download complete")}' '${root.downloadPath}/${root.fileName}' -a 'Shell'`)
}
}
}
@@ -4,6 +4,7 @@ import "root:/modules/common"
import "root:/modules/common/widgets"
import "root:/modules/common/functions/string_utils.js" as StringUtils
import "../"
import "root:/services/"
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
@@ -94,7 +95,7 @@ Rectangle {
font.pixelSize: Appearance.font.pixelSize.smaller
color: Appearance.colors.colOnLayer2
// text: `Page ${root.responseData.page}`
text: StringUtils.format(qsTr("Page {0}"), root.responseData.page)
text: StringUtils.format(Translation.tr("Page {0}"), root.responseData.page)
}
}
}