Merge pull request #1880 from notiant/patch-5

CustomButton: add translation for tooltips
This commit is contained in:
Lemmy
2026-02-20 18:43:06 -05:00
committed by GitHub
4 changed files with 23 additions and 32 deletions
+3 -12
View File
@@ -102,7 +102,7 @@
"collapse-condition-description": "If the output text matches this value, the button will collapse.",
"collapse-condition-label": "Collapse condition",
"color-selection-description": "Apply theme colors to icon and text.",
"default-tooltip": "Custom button, configure in settings.",
"default-tooltip": "Custom button, configure in settings",
"display-command-output-description": "Enter a command to run at a regular interval. The first line of its output will be displayed as text.",
"display-command-output-label": "Display command output",
"display-command-output-stream-description": "Enter a command to run continuously.",
@@ -144,12 +144,14 @@
"show-text-tooltip-label": "Show dynamic text tooltips",
"text-stream-description": "Streamed lines from the command will be displayed as text on the button.",
"text-stream-label": "Stream",
"wheel-down": "Scroll down",
"wheel-description": "Command to execute when the scroll wheel is used.<br>Use $delta for the scroll wheel delta in the command.",
"wheel-down-description": "Command to execute when the scroll wheel is scrolled down.",
"wheel-down-label": "Wheel down command",
"wheel-label": "Scroll wheel",
"wheel-mode-separate-description": "Enable separate commands for wheel up and down.",
"wheel-mode-separate-label": "Separate wheel commands",
"wheel-up": "Scroll up",
"wheel-up-description": "Command to execute when the scroll wheel is scrolled up.",
"wheel-up-label": "Wheel up command",
"wheel-update-text": "Update displayed text on scroll"
@@ -913,24 +915,13 @@
"desc": "Configure the control center panel positioning and behavior.",
"position-description": "Choose where the control center panel appears when opened.",
"shortcuts-custom-button-command-description": "The command to execute when the button is clicked.",
"shortcuts-custom-button-default-tooltip": "Custom button, configure in settings.",
"shortcuts-custom-button-enable-on-state-logic-description": "Enable a second icon and 'hot' state based on a check command.",
"shortcuts-custom-button-enable-on-state-logic-label": "Enable on-state logic",
"shortcuts-custom-button-general-tooltip-text-description": "General description for the button's tooltip.",
"shortcuts-custom-button-general-tooltip-text-label": "General tooltip text",
"shortcuts-custom-button-icon-description": "Select an icon from the library.",
"shortcuts-custom-button-on-clicked-description": "Command to execute when the button is left-clicked.",
"shortcuts-custom-button-on-clicked-label": "Left click command",
"shortcuts-custom-button-on-middle-clicked-description": "Command to execute when the button is middle-clicked.",
"shortcuts-custom-button-on-middle-clicked-label": "Middle click command",
"shortcuts-custom-button-on-right-clicked-description": "Command to execute when the button is right-clicked.",
"shortcuts-custom-button-on-right-clicked-label": "Right click command",
"shortcuts-custom-button-on-state-command-description": "Command to execute to check if the button should be in the 'on' state. Returns 0 for on, non-zero for off.",
"shortcuts-custom-button-on-state-command-label": "On-state check command",
"shortcuts-custom-button-on-state-icon-description": "The icon for the button when it's in the 'on' state.",
"shortcuts-custom-button-on-state-icon-label": "On-state icon",
"shortcuts-custom-button-show-exec-tooltip-description": "Show tooltips with command details (left/right/middle click).",
"shortcuts-custom-button-show-exec-tooltip-label": "Show command tooltips",
"shortcuts-custom-button-state-checks-add": "Add state check",
"shortcuts-custom-button-state-checks-command": "Command to execute for this state check",
"shortcuts-custom-button-state-checks-label": "State checks",
+6 -6
View File
@@ -219,22 +219,22 @@ Item {
// Add command details if enabled and available
if (showExecTooltip && hasExec) {
if (leftClickExec !== "") {
lines.push(`Left click: ${leftClickExec}.`);
lines.push(I18n.tr("bar.custom-button.left-click-label") + `: ${leftClickExec}`);
}
if (rightClickExec !== "") {
lines.push(`Right click: ${rightClickExec}.`);
lines.push(I18n.tr("bar.custom-button.right-click-label") + `: ${rightClickExec}`);
}
if (middleClickExec !== "") {
lines.push(`Middle click: ${middleClickExec}.`);
lines.push(I18n.tr("bar.custom-button.middle-click-label") + `: ${middleClickExec}`);
}
if (wheelMode === "unified" && wheelExec !== "") {
lines.push(`Wheel: ${wheelExec}.`);
lines.push(I18n.tr("bar.custom-button.wheel-label") + `: ${wheelExec}`);
} else if (wheelMode === "separate") {
if (wheelUpExec !== "") {
lines.push(`Wheel up: ${wheelUpExec}.`);
lines.push(I18n.tr("bar.custom-button.wheel-up") + `: ${wheelUpExec}`);
}
if (wheelDownExec !== "") {
lines.push(`Wheel down: ${wheelDownExec}.`);
lines.push(I18n.tr("bar.custom-button.wheel-down") + `Wheel down: ${wheelDownExec}`);
}
}
}
@@ -132,19 +132,19 @@ Item {
if (_hasCustomTooltip) {
tooltip = generalTooltipText;
} else if (!showExecTooltip) {
tooltip = I18n.tr("panels.control-center.shortcuts-custom-button-default-tooltip");
tooltip = I18n.tr("bar.custom-button.default-tooltip");
}
// Add command details if enabled
if (showExecTooltip) {
if (onClickedCommand) {
tooltip += tooltip ? `\nLeft click: ${onClickedCommand}` : `Left click: ${onClickedCommand}`;
tooltip += (tooltip ? "\n" : "") + I18n.tr("bar.custom-button.left-click-label") + `: ${onClickedCommand}`;
}
if (onRightClickedCommand) {
tooltip += tooltip ? `\nRight click: ${onRightClickedCommand}` : `Right click: ${onRightClickedCommand}`;
tooltip += (tooltip ? "\n" : "") + I18n.tr("bar.custom-button.right-click-label") + `: ${onRightClickedCommand}`;
}
if (onMiddleClickedCommand) {
tooltip += tooltip ? `\nMiddle click: ${onMiddleClickedCommand}` : `Middle click: ${onMiddleClickedCommand}`;
tooltip += (tooltip ? "\n" : "") + I18n.tr("bar.custom-button.middle-click-label") + `: ${onMiddleClickedCommand}`;
}
}
@@ -135,8 +135,8 @@ ColumnLayout {
NTextInput {
Layout.fillWidth: true
label: I18n.tr("panels.control-center.shortcuts-custom-button-general-tooltip-text-label")
description: I18n.tr("panels.control-center.shortcuts-custom-button-general-tooltip-text-description")
label: I18n.tr("bar.custom-button.general-tooltip-text-label")
description: I18n.tr("bar.custom-button.general-tooltip-text-description")
placeholderText: I18n.tr("placeholders.enter-tooltip")
text: _settings.generalTooltipText
onEditingFinished: {
@@ -147,8 +147,8 @@ ColumnLayout {
NToggle {
Layout.fillWidth: true
label: I18n.tr("panels.control-center.shortcuts-custom-button-show-exec-tooltip-label")
description: I18n.tr("panels.control-center.shortcuts-custom-button-show-exec-tooltip-description")
label: I18n.tr("bar.custom-button.show-exec-tooltip-label")
description: I18n.tr("bar.custom-button.show-exec-tooltip-description")
checked: _settings.showExecTooltip
onToggled: checked => {
_settings.showExecTooltip = checked;
@@ -158,8 +158,8 @@ ColumnLayout {
NTextInput {
Layout.fillWidth: true
label: I18n.tr("panels.control-center.shortcuts-custom-button-on-clicked-label")
description: I18n.tr("panels.control-center.shortcuts-custom-button-on-clicked-description")
label: I18n.tr("bar.custom-button.left-click-label")
description: I18n.tr("bar.custom-button.left-click-description")
placeholderText: I18n.tr("placeholders.enter-command")
text: _settings.onClicked
onEditingFinished: {
@@ -170,8 +170,8 @@ ColumnLayout {
NTextInput {
Layout.fillWidth: true
label: I18n.tr("panels.control-center.shortcuts-custom-button-on-right-clicked-label")
description: I18n.tr("panels.control-center.shortcuts-custom-button-on-right-clicked-description")
label: I18n.tr("bar.custom-button.right-click-label")
description: I18n.tr("bar.custom-button.right-click-description")
placeholderText: I18n.tr("placeholders.enter-command")
text: _settings.onRightClicked
onEditingFinished: {
@@ -182,8 +182,8 @@ ColumnLayout {
NTextInput {
Layout.fillWidth: true
label: I18n.tr("panels.control-center.shortcuts-custom-button-on-middle-clicked-label")
description: I18n.tr("panels.control-center.shortcuts-custom-button-on-middle-clicked-description")
label: I18n.tr("bar.custom-button.middle-click-label")
description: I18n.tr("bar.custom-button.middle-click-description")
placeholderText: I18n.tr("placeholders.enter-command")
text: _settings.onMiddleClicked
onEditingFinished: {