mfking chore: add qsTr() to strings for translations

This commit is contained in:
end-4
2025-05-20 00:35:09 +02:00
parent 26a5dbd91c
commit a32edd387e
26 changed files with 78 additions and 72 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ Singleton {
GlobalShortcut { GlobalShortcut {
name: "workspaceNumber" name: "workspaceNumber"
description: "Hold to show workspace numbers, release to show icons" description: qsTr("Hold to show workspace numbers, release to show icons")
onPressed: { onPressed: {
workspaceShowNumbersTimer.start() workspaceShowNumbersTimer.start()
+2 -2
View File
@@ -108,7 +108,7 @@ Scope {
ScrollHint { ScrollHint {
reveal: barLeftSideMouseArea.hovered reveal: barLeftSideMouseArea.hovered
icon: "light_mode" icon: "light_mode"
tooltipText: "Scroll to change brightness" tooltipText: qsTr("Scroll to change brightness")
side: "left" side: "left"
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -283,7 +283,7 @@ Scope {
ScrollHint { ScrollHint {
reveal: barRightSideMouseArea.hovered reveal: barRightSideMouseArea.hovered
icon: "volume_up" icon: "volume_up"
tooltipText: "Scroll to change volume" tooltipText: qsTr("Scroll to change volume")
side: "right" side: "right"
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
+1 -1
View File
@@ -12,7 +12,7 @@ import Quickshell.Hyprland
Item { Item {
id: root id: root
readonly property MprisPlayer activePlayer: MprisController.activePlayer readonly property MprisPlayer activePlayer: MprisController.activePlayer
readonly property string cleanedTitle: StringUtils.cleanMusicTitle(activePlayer?.trackTitle) || "No media" readonly property string cleanedTitle: StringUtils.cleanMusicTitle(activePlayer?.trackTitle) || qsTr("No media")
Layout.fillHeight: true Layout.fillHeight: true
implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2 implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2
@@ -156,7 +156,7 @@ Scope { // Scope
GlobalShortcut { GlobalShortcut {
name: "cheatsheetToggle" name: "cheatsheetToggle"
description: "Toggles cheatsheet on press" description: qsTr("Toggles cheatsheet on press")
onPressed: { onPressed: {
cheatsheetLoader.active = !cheatsheetLoader.active; cheatsheetLoader.active = !cheatsheetLoader.active;
@@ -165,7 +165,7 @@ Scope { // Scope
GlobalShortcut { GlobalShortcut {
name: "cheatsheetOpen" name: "cheatsheetOpen"
description: "Opens cheatsheet on press" description: qsTr("Opens cheatsheet on press")
onPressed: { onPressed: {
cheatsheetLoader.active = true; cheatsheetLoader.active = true;
@@ -174,7 +174,7 @@ Scope { // Scope
GlobalShortcut { GlobalShortcut {
name: "cheatsheetClose" name: "cheatsheetClose"
description: "Closes cheatsheet on press" description: qsTr("Closes cheatsheet on press")
onPressed: { onPressed: {
cheatsheetLoader.active = false; cheatsheetLoader.active = false;
@@ -5,7 +5,7 @@ pragma ComponentBehavior: Bound
Singleton { Singleton {
property QtObject ai: QtObject { property QtObject ai: QtObject {
property string systemPrompt: "Use casual tone. No user knowledge is to be assumed except basic Linux literacy. Be brief and concise: When explaining concepts, use bullet points (prefer minus sign (-) over asterisk (*)) and highlight keywords in bold to pinpoint the main concepts instead of long paragraphs. You are also encouraged to split your response with h2 headers, each header title beginning with an emoji, like `## 🐧 Linux`." property string systemPrompt: qsTr("Use casual tone. No user knowledge is to be assumed except basic Linux literacy. Be brief and concise: When explaining concepts, use bullet points (prefer minus sign (-) over asterisk (*)) and highlight keywords in bold to pinpoint the main concepts instead of long paragraphs. You are also encouraged to split your response with h2 headers, each header title beginning with an emoji, like `## 🐧 Linux`.")
} }
property QtObject appearance: QtObject { property QtObject appearance: QtObject {
@@ -70,7 +70,7 @@ Singleton {
property string defaultProvider: "yandere" property string defaultProvider: "yandere"
property int limit: 20 property int limit: 20
property QtObject zerochan: QtObject { property QtObject zerochan: QtObject {
property string username: "" property string username: "[unset]"
} }
} }
} }
@@ -127,7 +127,7 @@ Item {
onPressAndHold: (mouse) => { onPressAndHold: (mouse) => {
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
Hyprland.dispatch(`exec wl-copy '${StringUtils.shellSingleQuoteEscape(notificationObject.body)}'`) Hyprland.dispatch(`exec wl-copy '${StringUtils.shellSingleQuoteEscape(notificationObject.body)}'`)
notificationSummaryText.text = `${notificationObject.summary} (copied)` notificationSummaryText.text = String.format(qsTr("{0} (copied)"), notificationObject.summary)
} }
} }
onDragStartedChanged: () => { onDragStartedChanged: () => {
@@ -115,7 +115,7 @@ Scope {
GlobalShortcut { GlobalShortcut {
name: "mediaControlsToggle" name: "mediaControlsToggle"
description: "Toggles media controls on press" description: qsTr("Toggles media controls on press")
onPressed: { onPressed: {
if (!mediaControlsLoader.active && Mpris.players.values.filter(player => isRealPlayer(player)).length === 0) { if (!mediaControlsLoader.active && Mpris.players.values.filter(player => isRealPlayer(player)).length === 0) {
@@ -127,7 +127,7 @@ Scope {
} }
GlobalShortcut { GlobalShortcut {
name: "mediaControlsOpen" name: "mediaControlsOpen"
description: "Opens media controls on press" description: qsTr("Opens media controls on press")
onPressed: { onPressed: {
mediaControlsLoader.active = true; mediaControlsLoader.active = true;
@@ -136,7 +136,7 @@ Scope {
} }
GlobalShortcut { GlobalShortcut {
name: "mediaControlsClose" name: "mediaControlsClose"
description: "Closes media controls on press" description: qsTr("Closes media controls on press")
onPressed: { onPressed: {
mediaControlsLoader.active = false; mediaControlsLoader.active = false;
@@ -131,7 +131,7 @@ Scope {
GlobalShortcut { GlobalShortcut {
name: "osdBrightnessTrigger" name: "osdBrightnessTrigger"
description: "Triggers brightness OSD on press" description: qsTr("Triggers brightness OSD on press")
onPressed: { onPressed: {
root.triggerOsd() root.triggerOsd()
@@ -139,7 +139,7 @@ Scope {
} }
GlobalShortcut { GlobalShortcut {
name: "osdBrightnessHide" name: "osdBrightnessHide"
description: "Hides brightness OSD on press" description: qsTr("Hides brightness OSD on press")
onPressed: { onPressed: {
root.showOsdValues = false root.showOsdValues = false
@@ -129,7 +129,7 @@ Scope {
} }
GlobalShortcut { GlobalShortcut {
name: "osdVolumeTrigger" name: "osdVolumeTrigger"
description: "Triggers volume OSD on press" description: qsTr("Triggers volume OSD on press")
onPressed: { onPressed: {
root.triggerOsd() root.triggerOsd()
@@ -137,7 +137,7 @@ Scope {
} }
GlobalShortcut { GlobalShortcut {
name: "osdVolumeHide" name: "osdVolumeHide"
description: "Hides volume OSD on press" description: qsTr("Hides volume OSD on press")
onPressed: { onPressed: {
root.showOsdValues = false root.showOsdValues = false
@@ -128,7 +128,7 @@ Scope {
GlobalShortcut { GlobalShortcut {
name: "overviewToggle" name: "overviewToggle"
description: "Toggles overview on press" description: qsTr("Toggles overview on press")
onPressed: { onPressed: {
GlobalStates.overviewOpen = !GlobalStates.overviewOpen GlobalStates.overviewOpen = !GlobalStates.overviewOpen
@@ -136,7 +136,7 @@ Scope {
} }
GlobalShortcut { GlobalShortcut {
name: "overviewClose" name: "overviewClose"
description: "Closes overview" description: qsTr("Closes overview")
onPressed: { onPressed: {
GlobalStates.overviewOpen = false GlobalStates.overviewOpen = false
@@ -144,7 +144,7 @@ Scope {
} }
GlobalShortcut { GlobalShortcut {
name: "overviewToggleRelease" name: "overviewToggleRelease"
description: "Toggles overview on release" description: qsTr("Toggles overview on release")
onPressed: { onPressed: {
GlobalStates.superReleaseMightTrigger = true GlobalStates.superReleaseMightTrigger = true
@@ -160,9 +160,9 @@ Scope {
} }
GlobalShortcut { GlobalShortcut {
name: "overviewToggleReleaseInterrupt" name: "overviewToggleReleaseInterrupt"
description: "Interrupts possibility of overview being toggled on release. " + description: qsTr("Interrupts possibility of overview being toggled on release. ") +
"This is necessary because GlobalShortcut.onReleased in quickshell triggers whether or not you press something else while holding the key. " + qsTr("This is necessary because GlobalShortcut.onReleased in quickshell triggers whether or not you press something else while holding the key. ") +
"To make sure this works consistently, use binditn = MODKEYS, catchall in an automatically triggered submap that includes everything." qsTr("To make sure this works consistently, use binditn = MODKEYS, catchall in an automatically triggered submap that includes everything.")
onPressed: { onPressed: {
GlobalStates.superReleaseMightTrigger = false GlobalStates.superReleaseMightTrigger = false
@@ -103,7 +103,7 @@ Button {
StyledText { StyledText {
font.pixelSize: Appearance.font.pixelSize.small font.pixelSize: Appearance.font.pixelSize.small
color: Appearance.colors.colSubtext color: Appearance.colors.colSubtext
visible: root.itemType && root.itemType != "App" visible: root.itemType && root.itemType != qsTr("App")
text: root.itemType text: root.itemType
} }
StyledText { StyledText {
@@ -276,7 +276,7 @@ Item { // Wrapper
nonAppResultsTimer.restart(); nonAppResultsTimer.restart();
const mathResultObject = { const mathResultObject = {
name: root.mathResult, name: root.mathResult,
clickActionName: "Copy", clickActionName: qsTr("Copy"),
type: qsTr("Math result"), type: qsTr("Math result"),
fontType: "monospace", fontType: "monospace",
materialSymbol: 'calculate', materialSymbol: 'calculate',
@@ -286,7 +286,7 @@ Item { // Wrapper
} }
const commandResultObject = { const commandResultObject = {
name: searchingText, name: searchingText,
clickActionName: "Run", clickActionName: qsTr("Run"),
type: qsTr("Run command"), type: qsTr("Run command"),
fontType: "monospace", fontType: "monospace",
materialSymbol: 'terminal', materialSymbol: 'terminal',
@@ -300,8 +300,8 @@ Item { // Wrapper
if (actionString.startsWith(root.searchingText) || root.searchingText.startsWith(actionString)) { if (actionString.startsWith(root.searchingText) || root.searchingText.startsWith(actionString)) {
return { return {
name: root.searchingText.startsWith(actionString) ? root.searchingText : actionString, name: root.searchingText.startsWith(actionString) ? root.searchingText : actionString,
clickActionName: "Run", clickActionName: qsTr("Run"),
type: "Action", type: qsTr("Action"),
materialSymbol: 'settings_suggest', materialSymbol: 'settings_suggest',
execute: () => { execute: () => {
action.execute(root.searchingText.split(" ").slice(1).join(" ")) action.execute(root.searchingText.split(" ").slice(1).join(" "))
@@ -319,8 +319,8 @@ Item { // Wrapper
result = result.concat( result = result.concat(
AppSearch.fuzzyQuery(root.searchingText) AppSearch.fuzzyQuery(root.searchingText)
.map((entry) => { .map((entry) => {
entry.clickActionName = "Launch"; entry.clickActionName = qsTr("Launch");
entry.type = "App" entry.type = qsTr("App");
return entry; return entry;
}) })
); );
@@ -344,8 +344,8 @@ Item { // Wrapper
// Web search // Web search
result.push({ result.push({
name: root.searchingText, name: root.searchingText,
clickActionName: "Search", clickActionName: qsTr("Search"),
type: "Search the web", type: qsTr("Search the web"),
materialSymbol: 'travel_explore', materialSymbol: 'travel_explore',
execute: () => { execute: () => {
let url = ConfigOptions.search.engineBaseUrl + root.searchingText let url = ConfigOptions.search.engineBaseUrl + root.searchingText
@@ -361,8 +361,6 @@ Item { // Wrapper
} }
delegate: SearchItem { delegate: SearchItem {
entry: modelData entry: modelData
// itemName: modelData.name
// itemIcon: modelData.icon
} }
} }
@@ -209,7 +209,7 @@ Scope {
GlobalShortcut { GlobalShortcut {
name: "sessionToggle" name: "sessionToggle"
description: "Toggles session screen on press" description: qsTr("Toggles session screen on press")
onPressed: { onPressed: {
sessionLoader.active = !sessionLoader.active; sessionLoader.active = !sessionLoader.active;
@@ -218,7 +218,7 @@ Scope {
GlobalShortcut { GlobalShortcut {
name: "sessionOpen" name: "sessionOpen"
description: "Opens session screen on press" description: qsTr("Opens session screen on press")
onPressed: { onPressed: {
sessionLoader.active = true; sessionLoader.active = true;
@@ -192,7 +192,7 @@ Scope { // Scope
GlobalShortcut { GlobalShortcut {
name: "sidebarLeftToggle" name: "sidebarLeftToggle"
description: "Toggles left sidebar on press" description: qsTr("Toggles left sidebar on press")
onPressed: { onPressed: {
sidebarLoader.active = !sidebarLoader.active; sidebarLoader.active = !sidebarLoader.active;
@@ -202,7 +202,7 @@ Scope { // Scope
GlobalShortcut { GlobalShortcut {
name: "sidebarLeftOpen" name: "sidebarLeftOpen"
description: "Opens left sidebar on press" description: qsTr("Opens left sidebar on press")
onPressed: { onPressed: {
sidebarLoader.active = true; sidebarLoader.active = true;
@@ -212,7 +212,7 @@ Scope { // Scope
GlobalShortcut { GlobalShortcut {
name: "sidebarLeftClose" name: "sidebarLeftClose"
description: "Closes left sidebar on press" description: qsTr("Closes left sidebar on press")
onPressed: { onPressed: {
sidebarLoader.active = false; sidebarLoader.active = false;
@@ -151,7 +151,7 @@ Rectangle {
color: Appearance.m3colors.m3onSecondaryContainer color: Appearance.m3colors.m3onSecondaryContainer
text: messageData.role == 'assistant' ? Ai.models[messageData.model].name : text: messageData.role == 'assistant' ? Ai.models[messageData.model].name :
(messageData.role == 'user' && SystemInfo.username) ? SystemInfo.username : (messageData.role == 'user' && SystemInfo.username) ? SystemInfo.username :
(messageData.role == 'interface') ? qsTr("Interface") : qsTr("Unknown") qsTr("Interface")
} }
} }
} }
@@ -99,7 +99,7 @@ Item {
id: thinkBlockLanguage id: thinkBlockLanguage
Layout.fillWidth: false Layout.fillWidth: false
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
text: root.completed ? "Chain of Thought" : ("Thinking" + ".".repeat(Math.random() * 4)) text: root.completed ? qsTr("Chain of Thought") : (qsTr("Thinking") + ".".repeat(Math.random() * 4))
} }
Item { Layout.fillWidth: true } Item { Layout.fillWidth: true }
Button { // Expand button Button { // Expand button
@@ -94,7 +94,7 @@ Button {
PointingHandInteraction {} PointingHandInteraction {}
StyledToolTip { StyledToolTip {
content: `${StringUtils.wordWrap(root.imageData.tags, root.maxTagStringLineLength)}\nClick for options` content: `${StringUtils.wordWrap(root.imageData.tags, root.maxTagStringLineLength)}\n${qsTr("Click for options")}`
} }
background: Rectangle { background: Rectangle {
@@ -177,7 +177,7 @@ Button {
MenuButton { MenuButton {
id: downloadButton id: downloadButton
Layout.fillWidth: true Layout.fillWidth: true
buttonText: "Download" buttonText: qsTr("Download")
onClicked: { onClicked: {
root.showActions = false 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}'`) 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}'`)
@@ -2,6 +2,7 @@ import "root:/"
import "root:/services" import "root:/services"
import "root:/modules/common" import "root:/modules/common"
import "root:/modules/common/widgets" import "root:/modules/common/widgets"
import "root:/modules/common/functions/string_utils.js" as StringUtils
import "../" import "../"
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
@@ -93,7 +94,8 @@ Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
font.pixelSize: Appearance.font.pixelSize.smaller font.pixelSize: Appearance.font.pixelSize.smaller
color: Appearance.colors.colOnLayer2 color: Appearance.colors.colOnLayer2
text: `Page ${root.responseData.page}` // text: `Page ${root.responseData.page}`
text: StringUtils.format(qsTr("Page {0}"), root.responseData.page)
} }
} }
} }
@@ -2,6 +2,7 @@ import "root:/"
import "root:/services" import "root:/services"
import "root:/modules/common" import "root:/modules/common"
import "root:/modules/common/widgets" import "root:/modules/common/widgets"
import "root:/modules/common/functions/string_utils.js" as StringUtils
import "./quickToggles/" import "./quickToggles/"
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
@@ -102,7 +103,7 @@ Scope {
StyledText { StyledText {
font.pixelSize: Appearance.font.pixelSize.normal font.pixelSize: Appearance.font.pixelSize.normal
color: Appearance.colors.colOnLayer0 color: Appearance.colors.colOnLayer0
text: `Uptime: ${DateTime.uptime}` text: StringUtils.format(qsTr("Uptime: {0}"), DateTime.uptime)
textFormat: Text.MarkdownText textFormat: Text.MarkdownText
} }
@@ -197,7 +198,7 @@ Scope {
GlobalShortcut { GlobalShortcut {
name: "sidebarRightToggle" name: "sidebarRightToggle"
description: "Toggles right sidebar on press" description: qsTr("Toggles right sidebar on press")
onPressed: { onPressed: {
sidebarLoader.active = !sidebarLoader.active; sidebarLoader.active = !sidebarLoader.active;
@@ -206,7 +207,7 @@ Scope {
} }
GlobalShortcut { GlobalShortcut {
name: "sidebarRightOpen" name: "sidebarRightOpen"
description: "Opens right sidebar on press" description: qsTr("Opens right sidebar on press")
onPressed: { onPressed: {
sidebarLoader.active = true; sidebarLoader.active = true;
@@ -215,7 +216,7 @@ Scope {
} }
GlobalShortcut { GlobalShortcut {
name: "sidebarRightClose" name: "sidebarRightClose"
description: "Closes right sidebar on press" description: qsTr("Closes right sidebar on press")
onPressed: { onPressed: {
sidebarLoader.active = false; sidebarLoader.active = false;
@@ -2,6 +2,7 @@ import "../"
import "root:/services" import "root:/services"
import "root:/modules/common" import "root:/modules/common"
import "root:/modules/common/widgets" import "root:/modules/common/widgets"
import "root:/modules/common/functions/string_utils.js" as StringUtils
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
@@ -37,8 +38,9 @@ QuickToggleButton {
} }
} }
StyledToolTip { StyledToolTip {
content: `${(Bluetooth.bluetoothEnabled && Bluetooth.bluetoothDeviceName.length > 0) ? content: StringUtils.format(qsTr("{0} | Right-click to configure"),
Bluetooth.bluetoothDeviceName : "Bluetooth"} | ${qsTr("Right-click to configure")}` (Bluetooth.bluetoothEnabled && Bluetooth.bluetoothDeviceName.length > 0) ?
Bluetooth.bluetoothDeviceName : qsTr("Bluetooth"))
} }
} }
@@ -1,6 +1,7 @@
import "root:/services"
import "root:/modules/common" import "root:/modules/common"
import "root:/modules/common/widgets" import "root:/modules/common/widgets"
import "root:/services" import "root:/modules/common/functions/string_utils.js" as StringUtils
import "../" import "../"
import QtQuick import QtQuick
import Quickshell import Quickshell
@@ -42,6 +43,6 @@ QuickToggleButton {
} }
} }
StyledToolTip { StyledToolTip {
content: `${Network.networkName} | Right-click to configure` content: StringUtils.format(qsTr("{0} | Right-click to configure"), Network.networkName)
} }
} }
+11 -10
View File
@@ -36,14 +36,14 @@ Singleton {
"gemini-2.0-flash-search": { "gemini-2.0-flash-search": {
"name": "Gemini 2.0 Flash", "name": "Gemini 2.0 Flash",
"icon": "google-gemini-symbolic", "icon": "google-gemini-symbolic",
"description": "Online | Google's model\nGives up-to-date information with search.", "description": qsTr("Online | Google's model\nGives up-to-date information with search."),
"homepage": "https://aistudio.google.com", "homepage": "https://aistudio.google.com",
"endpoint": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:streamGenerateContent", "endpoint": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:streamGenerateContent",
"model": "gemini-2.0-flash", "model": "gemini-2.0-flash",
"requires_key": true, "requires_key": true,
"key_id": "gemini", "key_id": "gemini",
"key_get_link": "https://aistudio.google.com/app/apikey", "key_get_link": "https://aistudio.google.com/app/apikey",
"key_get_description": "**Pricing**: free. Data used for training.\n\n**Instructions**: Log into Google account, allow AI Studio to create Google Cloud project or whatever it asks, go back and click Get API key", "key_get_description": qsTr("**Pricing**: free. Data used for training.\n\n**Instructions**: Log into Google account, allow AI Studio to create Google Cloud project or whatever it asks, go back and click Get API key"),
"api_format": "gemini", "api_format": "gemini",
"tools": [ "tools": [
{ {
@@ -54,25 +54,26 @@ Singleton {
"openrouter-llama4-maverick": { "openrouter-llama4-maverick": {
"name": "Llama 4 Maverick", "name": "Llama 4 Maverick",
"icon": "ollama-symbolic", "icon": "ollama-symbolic",
"description": "Online via OpenRouter | Meta's model", "description": StringUtils.format(qsTr("Online via {0} | {1}'s model"), "OpenRouter", "Meta"),
"homepage": "https://openrouter.ai/meta-llama/llama-4-maverick:free", "homepage": "https://openrouter.ai/meta-llama/llama-4-maverick:free",
"endpoint": "https://openrouter.ai/api/v1/chat/completions", "endpoint": "https://openrouter.ai/api/v1/chat/completions",
"model": "meta-llama/llama-4-maverick:free", "model": "meta-llama/llama-4-maverick:free",
"requires_key": true, "requires_key": true,
"key_id": "openrouter", "key_id": "openrouter",
"key_get_link": "https://openrouter.ai/settings/keys", "key_get_link": "https://openrouter.ai/settings/keys",
"key_get_description": "**Pricing**: free. Data use policy varies depending on your OpenRouter account settings.\n\n**Instructions**: Log into OpenRouter account, go to Keys on the topright menu, click Create API Key", "key_get_description": qsTr("**Pricing**: free. Data use policy varies depending on your OpenRouter account settings.\n\n**Instructions**: Log into OpenRouter account, go to Keys on the topright menu, click Create API Key"),
}, },
"openrouter-deepseek-r1": { "openrouter-deepseek-r1": {
"name": "DeepSeek R1", "name": "DeepSeek R1",
"icon": "deepseek-symbolic", "icon": "deepseek-symbolic",
"description": "Online via OpenRouter | DeepSeek's reasoning model", "description": StringUtils.format(qsTr("Online via {0} | {1}'s model"), "OpenRouter", "DeepSeek"),
"homepage": "https://openrouter.ai/deepseek/deepseek-r1:free", "homepage": "https://openrouter.ai/deepseek/deepseek-r1:free",
"endpoint": "https://openrouter.ai/api/v1/chat/completions", "endpoint": "https://openrouter.ai/api/v1/chat/completions",
"model": "deepseek/deepseek-r1:free", "model": "deepseek/deepseek-r1:free",
"requires_key": true, "requires_key": true,
"key_id": "openrouter", "key_id": "openrouter",
"key_get_link": "https://openrouter.ai/settings/keys", "key_get_link": "https://openrouter.ai/settings/keys",
"key_get_description": qsTr("**Pricing**: free. Data use policy varies depending on your OpenRouter account settings.\n\n**Instructions**: Log into OpenRouter account, go to Keys on the topright menu, click Create API Key"),
}, },
} }
property var modelList: Object.keys(root.models) property var modelList: Object.keys(root.models)
@@ -117,7 +118,7 @@ Singleton {
root.models[model] = { root.models[model] = {
"name": guessModelName(model), "name": guessModelName(model),
"icon": guessModelLogo(model), "icon": guessModelLogo(model),
"description": `Local Ollama model: ${model}`, "description": StringUtils.format(qsTr("Local Ollama model | {0}"), model),
"homepage": `https://ollama.com/library/${model}`, "homepage": `https://ollama.com/library/${model}`,
"endpoint": "http://localhost:11434/v1/chat/completions", "endpoint": "http://localhost:11434/v1/chat/completions",
"model": model, "model": model,
@@ -167,7 +168,7 @@ Singleton {
modelId = modelId.toLowerCase() modelId = modelId.toLowerCase()
if (modelList.indexOf(modelId) !== -1) { if (modelList.indexOf(modelId) !== -1) {
PersistentStateManager.setState("ai.model", modelId); PersistentStateManager.setState("ai.model", modelId);
if (feedback) root.addMessage("Model set to " + models[modelId].name, Ai.interfaceRole) if (feedback) root.addMessage(StringUtils.format(StringUtils.format("Model set to {0}"), models[modelId].name, Ai.interfaceRole))
if (models[modelId].requires_key) { if (models[modelId].requires_key) {
// If key not there show advice // If key not there show advice
if (root.apiKeysLoaded && (!root.apiKeys[models[modelId].key_id] || root.apiKeys[models[modelId].key_id].length === 0)) { if (root.apiKeysLoaded && (!root.apiKeys[models[modelId].key_id] || root.apiKeys[models[modelId].key_id].length === 0)) {
@@ -185,7 +186,7 @@ Singleton {
function setApiKey(key) { function setApiKey(key) {
const model = models[currentModelId]; const model = models[currentModelId];
if (!model.requires_key) { if (!model.requires_key) {
root.addMessage(`${model.name} does not require an API key`, Ai.interfaceRole); root.addMessage(StringUtils.format(qsTr("{0} does not require an API key"), model.name), Ai.interfaceRole);
return; return;
} }
if (!key || key.length === 0) { if (!key || key.length === 0) {
@@ -194,7 +195,7 @@ Singleton {
return; return;
} }
KeyringStorage.setNestedField(["apiKeys", model.key_id], key.trim()); KeyringStorage.setNestedField(["apiKeys", model.key_id], key.trim());
root.addMessage("API key set for " + model.name, Ai.interfaceRole); root.addMessage(StringUtils.format(qsTr("API key set for {0}"), model.name, Ai.interfaceRole));
} }
function printApiKey() { function printApiKey() {
@@ -207,7 +208,7 @@ Singleton {
root.addMessage(StringUtils.format(qsTr("No API key set for {0}"), model.name), Ai.interfaceRole); root.addMessage(StringUtils.format(qsTr("No API key set for {0}"), model.name), Ai.interfaceRole);
} }
} else { } else {
root.addMessage(`This model (${model.name}) does not require an API key`, Ai.interfaceRole); root.addMessage(StringUtils.format(qsTr("{0} does not require an API key"), model.name), Ai.interfaceRole);
} }
} }
+2 -2
View File
@@ -19,7 +19,7 @@ Singleton {
property var defaultUserAgent: ConfigOptions?.networking?.userAgent || "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" property var defaultUserAgent: ConfigOptions?.networking?.userAgent || "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
property var providerList: ["yandere", "konachan", "zerochan", "danbooru", "gelbooru", "waifu.im"] property var providerList: ["yandere", "konachan", "zerochan", "danbooru", "gelbooru", "waifu.im"]
property var providers: { property var providers: {
"system": { "name": "System" }, "system": { "name": qsTr("System") },
"yandere": { "yandere": {
"name": "yande.re", "name": "yande.re",
"url": "https://yande.re", "url": "https://yande.re",
@@ -340,7 +340,7 @@ Singleton {
xhr.setRequestHeader("User-Agent", defaultUserAgent) xhr.setRequestHeader("User-Agent", defaultUserAgent)
} }
else if (currentProvider == "zerochan") { else if (currentProvider == "zerochan") {
const userAgent = ConfigOptions?.sidebar?.booru?.zerochan?.username ? `Desktop sidebar booru viewer - ${ConfigOptions.sidebar.booru.zerochan.username}` : defaultUserAgent const userAgent = ConfigOptions?.sidebar?.booru?.zerochan?.username ? `Desktop sidebar booru viewer - username: ${ConfigOptions.sidebar.booru.zerochan.username}` : defaultUserAgent
xhr.setRequestHeader("User-Agent", userAgent) xhr.setRequestHeader("User-Agent", userAgent)
} }
root.runningRequests++; root.runningRequests++;
+2 -2
View File
@@ -134,13 +134,13 @@ Singleton {
GlobalShortcut { GlobalShortcut {
name: "brightnessIncrease" name: "brightnessIncrease"
description: "Increase brightness" description: qsTr("Increase brightness")
onPressed: root.increaseBrightness() onPressed: root.increaseBrightness()
} }
GlobalShortcut { GlobalShortcut {
name: "brightnessDecrease" name: "brightnessDecrease"
description: "Decrease brightness" description: qsTr("Decrease brightness")
onPressed: root.decreaseBrightness() onPressed: root.decreaseBrightness()
} }
} }
+4 -4
View File
@@ -29,11 +29,11 @@ Singleton {
if (root.firstLoad) { if (root.firstLoad) {
root.firstLoad = false; root.firstLoad = false;
} else { } else {
Hyprland.dispatch(`exec notify-send "Shell configuration reloaded" "${root.filePath}"`) Hyprland.dispatch(`exec notify-send "${qsTr("Shell configuration reloaded")}" "${root.filePath}"`)
} }
} catch (e) { } catch (e) {
console.error("[ConfigLoader] Error reading file:", e); console.error("[ConfigLoader] Error reading file:", e);
Hyprland.dispatch(`exec notify-send "Shell configuration failed to load" "${root.filePath}"`) Hyprland.dispatch(`exec notify-send "${qsTr("Shell configuration failed to load")}" "${root.filePath}"`)
return; return;
} }
} }
@@ -66,9 +66,9 @@ Singleton {
console.log("[ConfigLoader] File not found, creating new file.") console.log("[ConfigLoader] File not found, creating new file.")
const plainConfig = ObjectUtils.toPlainObject(ConfigOptions) const plainConfig = ObjectUtils.toPlainObject(ConfigOptions)
configFileView.setText(JSON.stringify(plainConfig, null, 2)) configFileView.setText(JSON.stringify(plainConfig, null, 2))
Hyprland.dispatch(`exec notify-send "Shell configuration created" "${root.filePath}"`) Hyprland.dispatch(`exec notify-send "${qsTr("Shell configuration created")}" "${root.filePath}"`)
} else { } else {
Hyprland.dispatch(`exec notify-send "Shell configuration failed to load" "${root.filePath}"`) Hyprland.dispatch(`exec notify-send "${qsTr("Shell configuration failed to load")}" "${root.filePath}"`)
} }
} }
} }
@@ -2,6 +2,7 @@ pragma Singleton
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import "root:/modules/common" import "root:/modules/common"
import "root:/modules/common/functions/string_utils.js" as StringUtils
import Quickshell; import Quickshell;
import Quickshell.Io; import Quickshell.Io;
import Qt.labs.platform import Qt.labs.platform
@@ -18,14 +19,14 @@ Singleton {
property var properties: { property var properties: {
"application": "illogical-impulse", "application": "illogical-impulse",
"explanation": "For storing API keys and other sensitive information", "explanation": qsTr("For storing API keys and other sensitive information"),
} }
property var propertiesAsArgs: Object.keys(root.properties).reduce( property var propertiesAsArgs: Object.keys(root.properties).reduce(
function(arr, key) { function(arr, key) {
return arr.concat([key, root.properties[key]]); return arr.concat([key, root.properties[key]]);
}, [] }, []
) )
property string keyringLabel: "illogical-impulse Safe Storage" property string keyringLabel: StringUtils.format(qsTr("{0} Safe Storage"), "illogical-impulse")
function setNestedField(path, value) { function setNestedField(path, value) {
if (!root.keyringData) root.keyringData = {}; if (!root.keyringData) root.keyringData = {};