From 04f247905adf0edbc3fdfc23d4770564ec588904 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Wed, 24 Sep 2025 14:30:30 +0200 Subject: [PATCH] i18n-check: updated detection i18n: added some odd ones --- Assets/Translations/en.json | 24 ++++++++++++++++++- Bin/i18n-check.sh | 6 ++++- Modules/Launcher/Plugins/CalculatorPlugin.qml | 8 +++---- Modules/Launcher/Plugins/ClipboardPlugin.qml | 20 ++++++++-------- Modules/SessionMenu/SessionMenu.qml | 10 ++++---- Modules/Settings/Bar/BarSectionEditor.qml | 6 ++--- 6 files changed, 50 insertions(+), 24 deletions(-) diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 896e72d4..dcc0c456 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -938,6 +938,9 @@ "add-widget": "Add widget", "widget-settings": "Widget settings", "remove-widget": "Remove widget", + "move-to-left-section": "Move to left section", + "move-to-center-section": "Move to center section", + "move-to-right-section": "Move to right section", "open-settings": "Open settings", "session-menu": "Session Menu", "close-side-panel": "Close side panel", @@ -1060,10 +1063,29 @@ } } }, + "session-menu": { + "lock": "Lock", + "suspend": "Suspend", + "reboot": "Reboot", + "logout": "Logout", + "shutdown": "Shutdown" + }, "plugins": { "applications": "Applications", "clipboard": "Clipboard history", - "calculator": "Calculator" + "calculator": "Calculator", + "clipboard-search-description": "Search clipboard history", + "clipboard-clear-description": "Clear all clipboard history", + "clipboard-history-disabled": "Clipboard history disabled", + "clipboard-history-disabled-description": "Enable clipboard history in settings or install cliphist", + "clipboard-clear-history": "Clear clipboard history", + "clipboard-clear-description-full": "Remove all items from clipboard history", + "clipboard-loading": "Loading clipboard history...", + "clipboard-loading-description": "Please wait", + "calculator-description": "Calculator - evaluate mathematical expressions", + "calculator-name": "Calculator", + "calculator-enter-expression": "Enter a mathematical expression", + "calculator-error": "Error" }, "system": { "uptime": "System uptime: {uptime}", diff --git a/Bin/i18n-check.sh b/Bin/i18n-check.sh index 553370d6..e86abd7b 100755 --- a/Bin/i18n-check.sh +++ b/Bin/i18n-check.sh @@ -17,11 +17,15 @@ find . -name "*.qml" -type f | while read -r file; do # Check for property assignments with hardcoded strings property_issues=$(grep -n -E 'property\s+string\s+\w+:\s*"[^"]*[a-zA-Z][^"]*"' "$file" | grep -v 'I18n\.tr') - if [[ -n "$issues" || -n "$template_issues" || -n "$property_issues" ]]; then + # Check for JavaScript object properties with hardcoded strings (like in arrays/models) + js_object_issues=$(grep -n -E '"(label|text|title|description|placeholder|name)":\s*"[^"]*[a-zA-Z][^"]*"' "$file" | grep -v 'I18n\.tr') + + if [[ -n "$issues" || -n "$template_issues" || -n "$property_issues" || -n "$js_object_issues" ]]; then echo "$file" [[ -n "$issues" ]] && echo "$issues" [[ -n "$template_issues" ]] && echo "$template_issues" [[ -n "$property_issues" ]] && echo "$property_issues" + [[ -n "$js_object_issues" ]] && echo "$js_object_issues" echo fi done \ No newline at end of file diff --git a/Modules/Launcher/Plugins/CalculatorPlugin.qml b/Modules/Launcher/Plugins/CalculatorPlugin.qml index 3f0b1a03..d3573b72 100644 --- a/Modules/Launcher/Plugins/CalculatorPlugin.qml +++ b/Modules/Launcher/Plugins/CalculatorPlugin.qml @@ -14,7 +14,7 @@ Item { function commands() { return [{ "name": ">calc", - "description": "Calculator - evaluate mathematical expressions", + "description": I18n.tr("plugins.calculator-description"), "icon": "accessories-calculator", "isImage": false, "onActivate": function () { @@ -36,8 +36,8 @@ Item { if (!expression) { return [{ - "name": "Calculator", - "description": "Enter a mathematical expression", + "name": I18n.tr("plugins.calculator-name"), + "description": I18n.tr("plugins.calculator-enter-expression"), "icon": "accessories-calculator", "isImage": false, "onActivate": function () {} @@ -59,7 +59,7 @@ Item { }] } catch (error) { return [{ - "name": "Error", + "name": I18n.tr("plugins.calculator-error"), "description": error.message || "Invalid expression", "icon": "dialog-error", "isImage": false, diff --git a/Modules/Launcher/Plugins/ClipboardPlugin.qml b/Modules/Launcher/Plugins/ClipboardPlugin.qml index 271f7823..1969606c 100644 --- a/Modules/Launcher/Plugins/ClipboardPlugin.qml +++ b/Modules/Launcher/Plugins/ClipboardPlugin.qml @@ -68,7 +68,7 @@ Item { function commands() { return [{ "name": ">clip", - "description": "Search clipboard history", + "description": I18n.tr("plugins.clipboard-search-description"), "icon": "text-x-generic", "isImage": false, "onActivate": function () { @@ -76,7 +76,7 @@ Item { } }, { "name": ">clip clear", - "description": "Clear all clipboard history", + "description": I18n.tr("plugins.clipboard-clear-description"), "icon": "text-x-generic", "isImage": false, "onActivate": function () { @@ -99,8 +99,8 @@ Item { // Check if clipboard service is not active if (!ClipboardService.active) { return [{ - "name": "Clipboard history disabled", - "description": "Enable clipboard history in settings or install cliphist", + "name": I18n.tr("plugins.clipboard-history-disabled"), + "description": I18n.tr("plugins.clipboard-history-disabled-description"), "icon": "view-refresh", "isImage": false, "onActivate": function () {} @@ -110,8 +110,8 @@ Item { // Special command: clear if (query === "clear") { return [{ - "name": "Clear clipboard history", - "description": "Remove all items from clipboard history", + "name": I18n.tr("plugins.clipboard-clear-history"), + "description": I18n.tr("plugins.clipboard-clear-description-full"), "icon": "delete_sweep", "isImage": false, "onActivate": function () { @@ -124,8 +124,8 @@ Item { // Show loading state if data is being loaded if (ClipboardService.loading || isWaitingForData) { return [{ - "name": "Loading clipboard history...", - "description": "Please wait", + "name": I18n.tr("plugins.clipboard-loading"), + "description": I18n.tr("plugins.clipboard-loading-description"), "icon": "view-refresh", "isImage": false, "onActivate": function () {} @@ -140,8 +140,8 @@ Item { isWaitingForData = true ClipboardService.list(100) return [{ - "name": "Loading clipboard history...", - "description": "Please wait", + "name": I18n.tr("plugins.clipboard-loading"), + "description": I18n.tr("plugins.clipboard-loading-description"), "icon": "view-refresh", "isImage": false, "onActivate": function () {} diff --git a/Modules/SessionMenu/SessionMenu.qml b/Modules/SessionMenu/SessionMenu.qml index b3a1b1a2..a24f0343 100644 --- a/Modules/SessionMenu/SessionMenu.qml +++ b/Modules/SessionMenu/SessionMenu.qml @@ -30,27 +30,27 @@ NPanel { readonly property var powerOptions: [{ "action": "lock", "icon": "lock", - "title": "Lock", + "title": I18n.tr("session-menu.lock"), "subtitle": "Lock your session" }, { "action": "suspend", "icon": "suspend", - "title": "Suspend", + "title": I18n.tr("session-menu.suspend"), "subtitle": "Put the system to sleep" }, { "action": "reboot", "icon": "reboot", - "title": "Reboot", + "title": I18n.tr("session-menu.reboot"), "subtitle": "Restart the system" }, { "action": "logout", "icon": "logout", - "title": "Logout", + "title": I18n.tr("session-menu.logout"), "subtitle": "End your session" }, { "action": "shutdown", "icon": "shutdown", - "title": "Shutdown", + "title": I18n.tr("session-menu.shutdown"), "subtitle": "Turn off the system", "isShutdown": true }] diff --git a/Modules/Settings/Bar/BarSectionEditor.qml b/Modules/Settings/Bar/BarSectionEditor.qml index 86b5e72f..6e1fb69a 100644 --- a/Modules/Settings/Bar/BarSectionEditor.qml +++ b/Modules/Settings/Bar/BarSectionEditor.qml @@ -166,17 +166,17 @@ NBox { parent: Overlay.overlay width: 240 * scaling model: [{ - "label": "Move to left section", + "label": I18n.tr("tooltips.move-to-left-section"), "action": "left", "icon": "arrow-bar-to-left", "visible": root.sectionId !== "left" }, { - "label": "Move to center section", + "label": I18n.tr("tooltips.move-to-center-section"), "action": "center", "icon": "layout-columns", "visible": root.sectionId !== "center" }, { - "label": "Move to right section", + "label": I18n.tr("tooltips.move-to-right-section"), "action": "right", "icon": "arrow-bar-to-right", "visible": root.sectionId !== "right"