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
@@ -220,7 +220,7 @@ Item { // Wrapper
color: activeFocus ? Appearance.m3colors.m3onSurface : Appearance.m3colors.m3onSurfaceVariant
selectedTextColor: Appearance.m3colors.m3onSecondaryContainer
selectionColor: Appearance.colors.colSecondaryContainer
placeholderText: qsTr("Search, calculate or run")
placeholderText: Translation.tr("Search, calculate or run")
placeholderTextColor: Appearance.m3colors.m3outline
implicitWidth: root.searchingText == "" ? Appearance.sizes.searchWidthCollapsed : Appearance.sizes.searchWidth
@@ -329,8 +329,8 @@ Item { // Wrapper
nonAppResultsTimer.restart();
const mathResultObject = {
name: root.mathResult,
clickActionName: qsTr("Copy"),
type: qsTr("Math result"),
clickActionName: Translation.tr("Copy"),
type: Translation.tr("Math result"),
fontType: "monospace",
materialSymbol: 'calculate',
execute: () => {
@@ -339,8 +339,8 @@ Item { // Wrapper
}
const commandResultObject = {
name: searchingText.replace("file://", ""),
clickActionName: qsTr("Run"),
type: qsTr("Run command"),
clickActionName: Translation.tr("Run"),
type: Translation.tr("Run command"),
fontType: "monospace",
materialSymbol: 'terminal',
execute: () => {
@@ -353,8 +353,8 @@ Item { // Wrapper
if (actionString.startsWith(root.searchingText) || root.searchingText.startsWith(actionString)) {
return {
name: root.searchingText.startsWith(actionString) ? root.searchingText : actionString,
clickActionName: qsTr("Run"),
type: qsTr("Action"),
clickActionName: Translation.tr("Run"),
type: Translation.tr("Action"),
materialSymbol: 'settings_suggest',
execute: () => {
action.execute(root.searchingText.split(" ").slice(1).join(" "))
@@ -371,8 +371,8 @@ Item { // Wrapper
result = result.concat(
AppSearch.fuzzyQuery(root.searchingText)
.map((entry) => {
entry.clickActionName = qsTr("Launch");
entry.type = qsTr("App");
entry.clickActionName = Translation.tr("Launch");
entry.type = Translation.tr("App");
return entry;
})
);
@@ -393,8 +393,8 @@ Item { // Wrapper
///////////////// Web search ////////////////
result.push({
name: root.searchingText,
clickActionName: qsTr("Search"),
type: qsTr("Search the web"),
clickActionName: Translation.tr("Search"),
type: Translation.tr("Search the web"),
materialSymbol: 'travel_explore',
execute: () => {
let url = ConfigOptions.search.engineBaseUrl + root.searchingText