forked from Shinonome/dots-hyprland
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:
@@ -6,6 +6,7 @@ import "root:/modules/common/functions/fuzzysort.js" as Fuzzy
|
||||
import "root:/modules/common/functions/string_utils.js" as StringUtils
|
||||
import "root:/modules/common/functions/file_utils.js" as FileUtils
|
||||
import "./anime/"
|
||||
import "root:/services/"
|
||||
import Qt.labs.platform
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
@@ -39,21 +40,21 @@ Item {
|
||||
property var allCommands: [
|
||||
{
|
||||
name: "mode",
|
||||
description: qsTr("Set the current API provider"),
|
||||
description: Translation.tr("Set the current API provider"),
|
||||
execute: (args) => {
|
||||
Booru.setProvider(args[0]);
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "clear",
|
||||
description: qsTr("Clear the current list of images"),
|
||||
description: Translation.tr("Clear the current list of images"),
|
||||
execute: () => {
|
||||
Booru.clearResponses();
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "next",
|
||||
description: qsTr("Get the next page of results"),
|
||||
description: Translation.tr("Get the next page of results"),
|
||||
execute: () => {
|
||||
if (root.responses.length > 0) {
|
||||
const lastResponse = root.responses[root.responses.length - 1];
|
||||
@@ -63,14 +64,14 @@ Item {
|
||||
},
|
||||
{
|
||||
name: "safe",
|
||||
description: qsTr("Disable NSFW content"),
|
||||
description: Translation.tr("Disable NSFW content"),
|
||||
execute: () => {
|
||||
PersistentStateManager.setState("booru.allowNsfw", false);
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "lewd",
|
||||
description: qsTr("Allow NSFW content"),
|
||||
description: Translation.tr("Allow NSFW content"),
|
||||
execute: () => {
|
||||
PersistentStateManager.setState("booru.allowNsfw", true);
|
||||
}
|
||||
@@ -86,7 +87,7 @@ Item {
|
||||
if (commandObj) {
|
||||
commandObj.execute(args);
|
||||
} else {
|
||||
Booru.addSystemMessage(qsTr("Unknown command: ") + command);
|
||||
Booru.addSystemMessage(Translation.tr("Unknown command: ") + command);
|
||||
}
|
||||
}
|
||||
else if (inputText.trim() == "+") {
|
||||
@@ -208,7 +209,7 @@ Item {
|
||||
font.family: Appearance.font.family.title
|
||||
color: Appearance.m3colors.m3outline
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: qsTr("Anime boorus")
|
||||
text: Translation.tr("Anime boorus")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -245,7 +246,7 @@ Item {
|
||||
font.pixelSize: Appearance.font.pixelSize.smaller
|
||||
color: Appearance.m3colors.m3inverseOnSurface
|
||||
wrapMode: Text.Wrap
|
||||
text: StringUtils.format(qsTr("{0} queries pending"), Booru.runningRequests)
|
||||
text: StringUtils.format(Translation.tr("{0} queries pending"), Booru.runningRequests)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -381,7 +382,7 @@ Item {
|
||||
padding: 10
|
||||
color: activeFocus ? Appearance.m3colors.m3onSurface : Appearance.m3colors.m3onSurfaceVariant
|
||||
renderType: Text.NativeRendering
|
||||
placeholderText: StringUtils.format(qsTr('Enter tags, or "{0}" for commands'), root.commandPrefix)
|
||||
placeholderText: StringUtils.format(Translation.tr('Enter tags, or "{0}" for commands'), root.commandPrefix)
|
||||
|
||||
background: null
|
||||
|
||||
@@ -544,8 +545,8 @@ Item {
|
||||
id: toolTip
|
||||
extraVisibleCondition: false
|
||||
alternativeVisibleCondition: mouseArea.containsMouse // Show tooltip when hovered
|
||||
// content: qsTr("The current API used. Endpoint: ") + Booru.providers[Booru.currentProvider].url + qsTr("\nSet with /mode PROVIDER")
|
||||
content: StringUtils.format(qsTr("Current API endpoint: {0}\nSet it with {1}mode PROVIDER"),
|
||||
// content: Translation.tr("The current API used. Endpoint: ") + Booru.providers[Booru.currentProvider].url + Translation.tr("\nSet with /mode PROVIDER")
|
||||
content: StringUtils.format(Translation.tr("Current API endpoint: {0}\nSet it with {1}mode PROVIDER"),
|
||||
Booru.providers[Booru.currentProvider].url, root.commandPrefix)
|
||||
}
|
||||
|
||||
@@ -586,7 +587,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
font.pixelSize: Appearance.font.pixelSize.smaller
|
||||
color: nsfwSwitch.enabled ? Appearance.colors.colOnLayer1 : Appearance.m3colors.m3outline
|
||||
text: qsTr("Allow NSFW")
|
||||
text: Translation.tr("Allow NSFW")
|
||||
}
|
||||
StyledSwitch {
|
||||
id: nsfwSwitch
|
||||
|
||||
Reference in New Issue
Block a user