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
+12 -12
View File
@@ -70,7 +70,7 @@ Scope {
font.family: Appearance.font.family.title
font.pixelSize: Appearance.font.pixelSize.title
font.weight: Font.DemiBold
text: qsTr("Session")
text: Translation.tr("Session")
}
StyledText { // Small instruction
@@ -78,7 +78,7 @@ Scope {
horizontalAlignment: Text.AlignHCenter
font.family: Appearance.font.family.title
font.pixelSize: Appearance.font.pixelSize.normal
text: qsTr("Arrow keys to navigate, Enter to select\nEsc or click anywhere to cancel")
text: Translation.tr("Arrow keys to navigate, Enter to select\nEsc or click anywhere to cancel")
}
}
@@ -91,7 +91,7 @@ Scope {
id: sessionLock
focus: sessionRoot.visible
buttonIcon: "lock"
buttonText: qsTr("Lock")
buttonText: Translation.tr("Lock")
onClicked: { Hyprland.dispatch("exec loginctl lock-session"); sessionRoot.hide() }
onFocusChanged: { if (focus) sessionRoot.subtitle = buttonText }
KeyNavigation.right: sessionSleep
@@ -100,7 +100,7 @@ Scope {
SessionActionButton {
id: sessionSleep
buttonIcon: "dark_mode"
buttonText: qsTr("Sleep")
buttonText: Translation.tr("Sleep")
onClicked: { Hyprland.dispatch("exec systemctl suspend || loginctl suspend"); sessionRoot.hide() }
onFocusChanged: { if (focus) sessionRoot.subtitle = buttonText }
KeyNavigation.left: sessionLock
@@ -110,7 +110,7 @@ Scope {
SessionActionButton {
id: sessionLogout
buttonIcon: "logout"
buttonText: qsTr("Logout")
buttonText: Translation.tr("Logout")
onClicked: { Hyprland.dispatch("exec pkill Hyprland"); sessionRoot.hide() }
onFocusChanged: { if (focus) sessionRoot.subtitle = buttonText }
KeyNavigation.left: sessionSleep
@@ -120,7 +120,7 @@ Scope {
SessionActionButton {
id: sessionTaskManager
buttonIcon: "browse_activity"
buttonText: qsTr("Task Manager")
buttonText: Translation.tr("Task Manager")
onClicked: { Hyprland.dispatch(`exec ${ConfigOptions.apps.taskManager}`); sessionRoot.hide() }
onFocusChanged: { if (focus) sessionRoot.subtitle = buttonText }
KeyNavigation.left: sessionLogout
@@ -130,7 +130,7 @@ Scope {
SessionActionButton {
id: sessionHibernate
buttonIcon: "downloading"
buttonText: qsTr("Hibernate")
buttonText: Translation.tr("Hibernate")
onClicked: { Hyprland.dispatch("exec systemctl hibernate || loginctl hibernate"); sessionRoot.hide() }
onFocusChanged: { if (focus) sessionRoot.subtitle = buttonText }
KeyNavigation.up: sessionLock
@@ -139,7 +139,7 @@ Scope {
SessionActionButton {
id: sessionShutdown
buttonIcon: "power_settings_new"
buttonText: qsTr("Shutdown")
buttonText: Translation.tr("Shutdown")
onClicked: { Hyprland.dispatch("exec systemctl poweroff || loginctl poweroff"); sessionRoot.hide() }
onFocusChanged: { if (focus) sessionRoot.subtitle = buttonText }
KeyNavigation.left: sessionHibernate
@@ -149,7 +149,7 @@ Scope {
SessionActionButton {
id: sessionReboot
buttonIcon: "restart_alt"
buttonText: qsTr("Reboot")
buttonText: Translation.tr("Reboot")
onClicked: { Hyprland.dispatch("exec reboot || loginctl reboot"); sessionRoot.hide() }
onFocusChanged: { if (focus) sessionRoot.subtitle = buttonText }
KeyNavigation.left: sessionShutdown
@@ -159,7 +159,7 @@ Scope {
SessionActionButton {
id: sessionFirmwareReboot
buttonIcon: "settings_applications"
buttonText: qsTr("Reboot to firmware settings")
buttonText: Translation.tr("Reboot to firmware settings")
onClicked: { Hyprland.dispatch("exec systemctl reboot --firmware-setup || loginctl reboot --firmware-setup"); sessionRoot.hide() }
onFocusChanged: { if (focus) sessionRoot.subtitle = buttonText }
KeyNavigation.up: sessionTaskManager
@@ -209,7 +209,7 @@ Scope {
GlobalShortcut {
name: "sessionToggle"
description: qsTr("Toggles session screen on press")
description: Translation.tr("Toggles session screen on press")
onPressed: {
sessionLoader.active = !sessionLoader.active;
@@ -218,7 +218,7 @@ Scope {
GlobalShortcut {
name: "sessionOpen"
description: qsTr("Opens session screen on press")
description: Translation.tr("Opens session screen on press")
onPressed: {
sessionLoader.active = true;