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
@@ -97,7 +97,7 @@ Item { // Notification item area
onPressAndHold: (mouse) => {
if (mouse.button === Qt.LeftButton) {
Hyprland.dispatch(`exec wl-copy '${StringUtils.shellSingleQuoteEscape(notificationObject.body)}'`)
notificationSummaryText.text = String.format(qsTr("{0} (copied)"), notificationObject.summary)
notificationSummaryText.text = String.format(Translation.tr("{0} (copied)"), notificationObject.summary)
}
}
onDraggingChanged: () => {
@@ -257,7 +257,7 @@ Item { // Notification item area
NotificationActionButton {
Layout.fillWidth: true
buttonText: qsTr("Close")
buttonText: Translation.tr("Close")
urgency: notificationObject.urgency
implicitWidth: (notificationObject.actions.length == 0) ? ((actionsFlickable.width - actionRowLayout.spacing) / 2) :
(contentItem.implicitWidth + leftPadding + rightPadding)
@@ -1,4 +1,5 @@
import "root:/modules/common"
import "root:/services/"
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
@@ -7,7 +8,7 @@ import Quickshell
ColumnLayout {
id: root
spacing: 0
required property var tabButtonList // Something like [{"icon": "notifications", "name": qsTr("Notifications")}, {"icon": "volume_up", "name": qsTr("Volume mixer")}]
required property var tabButtonList // Something like [{"icon": "notifications", "name": Translation.tr("Notifications")}, {"icon": "volume_up", "name": Translation.tr("Volume mixer")}]
required property var externalTrackedTab
property bool enableIndicatorAnimation: false
property color colIndicator: Appearance?.colors.colPrimary ?? "#65558F"
@@ -1,6 +1,7 @@
import "root:/modules/common"
import "root:/modules/common/widgets"
import "root:/services"
import "root:/services/"
import Qt5Compat.GraphicalEffects
import QtQuick
import QtQuick.Controls
@@ -113,11 +114,11 @@ Item {
Layout.alignment: Qt.AlignRight
DialogButton {
buttonText: qsTr("Cancel")
buttonText: Translation.tr("Cancel")
onClicked: root.canceled()
}
DialogButton {
buttonText: qsTr("OK")
buttonText: Translation.tr("OK")
onClicked: root.selected(
root.selectedId === -1 ? null :
root.items[root.selectedId]