From 94a09484aab4285e14fee50b12b679077d11d34f Mon Sep 17 00:00:00 2001 From: Lemmy Date: Fri, 23 Jan 2026 09:03:58 -0500 Subject: [PATCH 1/2] i18n: simplified trp --- Assets/Translations/de.json | 6 ++-- Assets/Translations/en.json | 7 ++-- Assets/Translations/es.json | 6 ++-- Assets/Translations/fr.json | 6 ++-- Assets/Translations/hu.json | 6 ++-- Assets/Translations/ja.json | 6 ++-- Assets/Translations/ku.json | 6 ++-- Assets/Translations/nl.json | 6 ++-- Assets/Translations/pl.json | 6 ++-- Assets/Translations/pt.json | 6 ++-- Assets/Translations/ru.json | 6 ++-- Assets/Translations/tr.json | 6 ++-- Assets/Translations/uk-UA.json | 6 ++-- Assets/Translations/zh-CN.json | 6 ++-- Assets/Translations/zh-TW.json | 6 ++-- Commons/I18n.qml | 17 ++++----- Modules/Panels/Launcher/Launcher.qml | 2 +- Services/Noctalia/PluginService.qml | 54 ++++++++++++---------------- 18 files changed, 76 insertions(+), 88 deletions(-) diff --git a/Assets/Translations/de.json b/Assets/Translations/de.json index 72ec4bda0..9dbd07ba3 100644 --- a/Assets/Translations/de.json +++ b/Assets/Translations/de.json @@ -430,6 +430,8 @@ "refresh": "Aktualisieren", "required": "(erforderlich)", "reset": "Zurücksetzen", + "result-count": "{count} Ergebnis", + "result-count-plural": "{count} Ergebnisse", "resume": "Fortsetzen", "save": "Speichern", "scanning": "Scannen...", @@ -539,9 +541,7 @@ "emoji-loading-description": "Bitte warten", "emoji-no-recent": "Noch keine kürzlich verwendeten Emojis", "emoji-search-description": "Emojis suchen und kopieren" - }, - "result": "Ergebnis", - "results": "Ergebnisse" + } }, "lock-screen": { "authenticating": "Authentifizierung...", diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 83c146987..891341252 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -430,6 +430,8 @@ "refresh": "Refresh", "required": "(required)", "reset": "Reset", + "result-count": "{count} result", + "result-count-plural": "{count} results", "resume": "Resume", "save": "Save", "scanning": "Scanning...", @@ -437,7 +439,6 @@ "search": "Search", "security": "Security", "select": "Select", - "settings": "Settings", "shortcuts": "Shortcuts", "shutdown": "Shutdown", "signal": "Signal", @@ -540,9 +541,7 @@ "emoji-loading-description": "Please wait", "emoji-no-recent": "No recent emojis yet", "emoji-search-description": "Search and copy emojis" - }, - "result": "result", - "results": "results" + } }, "lock-screen": { "authenticating": "Authenticating...", diff --git a/Assets/Translations/es.json b/Assets/Translations/es.json index 28c9206df..790a0e559 100644 --- a/Assets/Translations/es.json +++ b/Assets/Translations/es.json @@ -430,6 +430,8 @@ "refresh": "Refrescar", "required": "(obligatorio)", "reset": "Restablecer", + "result-count": "{count} resultado", + "result-count-plural": "{count} resultados", "resume": "Reanudar", "save": "Guardar", "scanning": "Escaneando...", @@ -539,9 +541,7 @@ "emoji-loading-description": "Por favor espera", "emoji-no-recent": "Aún no hay emojis recientes", "emoji-search-description": "Buscar y copiar emojis" - }, - "result": "resultado", - "results": "resultados" + } }, "lock-screen": { "authenticating": "Autenticando...", diff --git a/Assets/Translations/fr.json b/Assets/Translations/fr.json index ed3a30199..6259036c4 100644 --- a/Assets/Translations/fr.json +++ b/Assets/Translations/fr.json @@ -430,6 +430,8 @@ "refresh": "Actualiser", "required": "(requis)", "reset": "Réinitialiser", + "result-count": "{count} résultat", + "result-count-plural": "{count} résultats", "resume": "Reprendrer", "save": "Enregistrer", "scanning": "Analyse en cours...", @@ -539,9 +541,7 @@ "emoji-loading-description": "Veuillez patienter", "emoji-no-recent": "Aucun emoji récent pour le moment", "emoji-search-description": "Rechercher et copier des émojis" - }, - "result": "résultat", - "results": "résultats" + } }, "lock-screen": { "authenticating": "Authentification...", diff --git a/Assets/Translations/hu.json b/Assets/Translations/hu.json index 4863c973f..8ae3420ae 100644 --- a/Assets/Translations/hu.json +++ b/Assets/Translations/hu.json @@ -430,6 +430,8 @@ "refresh": "Frissítés", "required": "(kötelező)", "reset": "Visszaállítás", + "result-count": "{count} eredmény", + "result-count-plural": "eredmények", "resume": "Folytatás", "save": "Mentés", "scanning": "Szkennelés...", @@ -539,9 +541,7 @@ "emoji-loading-description": "Kérjük, várjon", "emoji-no-recent": "Nincsenek még legutóbbi emojik", "emoji-search-description": "Emojik keresése és másolása" - }, - "result": "eredmény", - "results": "eredmények" + } }, "lock-screen": { "authenticating": "Hitelesítés...", diff --git a/Assets/Translations/ja.json b/Assets/Translations/ja.json index cc4043672..b47a9228a 100644 --- a/Assets/Translations/ja.json +++ b/Assets/Translations/ja.json @@ -430,6 +430,8 @@ "refresh": "更新", "required": "(必須)", "reset": "リセット", + "result-count": "{count} 結果", + "result-count-plural": "{count} 結果", "resume": "再開", "save": "保存", "scanning": "スキャン中...", @@ -539,9 +541,7 @@ "emoji-loading-description": "お待ちください", "emoji-no-recent": "まだ最近使った絵文字はありません", "emoji-search-description": "絵文字を検索してコピー" - }, - "result": "結果", - "results": "結果" + } }, "lock-screen": { "authenticating": "認証中...", diff --git a/Assets/Translations/ku.json b/Assets/Translations/ku.json index ac67b60de..d2bc29e1a 100644 --- a/Assets/Translations/ku.json +++ b/Assets/Translations/ku.json @@ -430,6 +430,8 @@ "refresh": "Nûkirin", "required": "(pêwîst)", "reset": "Vegerandin", + "result-count": "{count} encam", + "result-count-plural": "{count} encaman", "resume": "Berdewam kirin", "save": "Tomar bike", "scanning": "Lêgerîn...", @@ -539,9 +541,7 @@ "emoji-loading-description": "Tika raweste", "emoji-no-recent": "Hîna emojiyên dawî tune ne", "emoji-search-description": "Lêgerîn û kopîkirina emojiyan" - }, - "result": "encam", - "results": "encaman" + } }, "lock-screen": { "authenticating": "Rastkirin...", diff --git a/Assets/Translations/nl.json b/Assets/Translations/nl.json index 8d1d519f8..605acdd05 100644 --- a/Assets/Translations/nl.json +++ b/Assets/Translations/nl.json @@ -430,6 +430,8 @@ "refresh": "Vernieuwen", "required": "(vereist)", "reset": "Resetten", + "result-count": "{count} resultaat", + "result-count-plural": "{count} resultaten", "resume": "Hervatten", "save": "Opslaan", "scanning": "Scannen...", @@ -539,9 +541,7 @@ "emoji-loading-description": "Even geduld", "emoji-no-recent": "Nog geen recente emoji's", "emoji-search-description": "Zoek en kopieer emoji's" - }, - "result": "resultaat", - "results": "resultaten" + } }, "lock-screen": { "authenticating": "Bezig met verifiëren...", diff --git a/Assets/Translations/pl.json b/Assets/Translations/pl.json index bf39fbf71..dc28d8fb5 100644 --- a/Assets/Translations/pl.json +++ b/Assets/Translations/pl.json @@ -430,6 +430,8 @@ "refresh": "Odśwież", "required": "(wymagane)", "reset": "Zresetuj", + "result-count": "{count} wynik", + "result-count-plural": "{count} wyniki", "resume": "Wznów", "save": "Zapisz", "scanning": "Skanowanie...", @@ -539,9 +541,7 @@ "emoji-loading-description": "Proszę czekać", "emoji-no-recent": "Brak ostatnich emoji", "emoji-search-description": "Szukaj i kopiuj emoji" - }, - "result": "wynik", - "results": "wyniki" + } }, "lock-screen": { "authenticating": "Uwierzytelnianie...", diff --git a/Assets/Translations/pt.json b/Assets/Translations/pt.json index 63dc2f13d..37a34f17b 100644 --- a/Assets/Translations/pt.json +++ b/Assets/Translations/pt.json @@ -430,6 +430,8 @@ "refresh": "Atualizar", "required": "(obrigatório)", "reset": "Reiniciar", + "result-count": "{count} resultado", + "result-count-plural": "{count} resultados", "resume": "Retomar", "save": "Salvar", "scanning": "A digitalização está em andamento...", @@ -539,9 +541,7 @@ "emoji-loading-description": "Por favor, aguarde", "emoji-no-recent": "Ainda não há emojis recentes", "emoji-search-description": "Buscar e copiar emojis" - }, - "result": "resultado", - "results": "resultados" + } }, "lock-screen": { "authenticating": "Autenticando...", diff --git a/Assets/Translations/ru.json b/Assets/Translations/ru.json index d0a4dfc12..5e694b5ae 100644 --- a/Assets/Translations/ru.json +++ b/Assets/Translations/ru.json @@ -430,6 +430,8 @@ "refresh": "Обновить", "required": "(обязательно)", "reset": "Сброс", + "result-count": "{count} результат", + "result-count-plural": "{count} результаты", "resume": "Продолжить", "save": "Сохранить", "scanning": "Сканирование...", @@ -539,9 +541,7 @@ "emoji-loading-description": "Пожалуйста, подождите", "emoji-no-recent": "Недавних эмодзи пока нет", "emoji-search-description": "Поиск и копирование эмодзи" - }, - "result": "результат", - "results": "результаты" + } }, "lock-screen": { "authenticating": "Аутентификация...", diff --git a/Assets/Translations/tr.json b/Assets/Translations/tr.json index 16c1e5d23..4f35fda81 100644 --- a/Assets/Translations/tr.json +++ b/Assets/Translations/tr.json @@ -430,6 +430,8 @@ "refresh": "Yenile", "required": "(gerekli)", "reset": "Sıfırla", + "result-count": "{count} sonuç", + "result-count-plural": "{count} sonuçlar", "resume": "Sürdür", "save": "Kaydet", "scanning": "Taranıyor...", @@ -539,9 +541,7 @@ "emoji-loading-description": "Lütfen bekleyin", "emoji-no-recent": "Henüz yeni emoji yok", "emoji-search-description": "Emoji arama ve kopyalama" - }, - "result": "sonuç", - "results": "sonuçlar" + } }, "lock-screen": { "authenticating": "Doğrulanıyor...", diff --git a/Assets/Translations/uk-UA.json b/Assets/Translations/uk-UA.json index 7b2ac2b3e..9ac0c00fc 100644 --- a/Assets/Translations/uk-UA.json +++ b/Assets/Translations/uk-UA.json @@ -430,6 +430,8 @@ "refresh": "Оновити", "required": "(обов'язково)", "reset": "Скинути", + "result-count": "{count} результат", + "result-count-plural": "{count} результати", "resume": "Продовжити", "save": "Зберегти", "scanning": "Сканування...", @@ -539,9 +541,7 @@ "emoji-loading-description": "Зачекайте, будь ласка", "emoji-no-recent": "Немає нещодавніх емодзі", "emoji-search-description": "Пошук і копіювання емодзі" - }, - "result": "результат", - "results": "результати" + } }, "lock-screen": { "authenticating": "Автентифікація...", diff --git a/Assets/Translations/zh-CN.json b/Assets/Translations/zh-CN.json index 843089fff..9a84c9b7e 100644 --- a/Assets/Translations/zh-CN.json +++ b/Assets/Translations/zh-CN.json @@ -430,6 +430,8 @@ "refresh": "刷新", "required": "(必要)", "reset": "重置", + "result-count": "{count} 结果", + "result-count-plural": "{count} 结果", "resume": "继续", "save": "保存", "scanning": "扫描中...", @@ -539,9 +541,7 @@ "emoji-loading-description": "请稍候", "emoji-no-recent": "尚无最近使用的表情符号", "emoji-search-description": "搜索和复制表情符号" - }, - "result": "结果", - "results": "结果" + } }, "lock-screen": { "authenticating": "正在验证...", diff --git a/Assets/Translations/zh-TW.json b/Assets/Translations/zh-TW.json index a36a8fb80..ab11c72c2 100644 --- a/Assets/Translations/zh-TW.json +++ b/Assets/Translations/zh-TW.json @@ -430,6 +430,8 @@ "refresh": "重新整理", "required": "(必要)", "reset": "重設", + "result-count": "{count} 筆結果", + "result-count-plural": "{count} 筆結果", "resume": "繼續", "save": "儲存", "scanning": "掃描中...", @@ -539,9 +541,7 @@ "emoji-loading-description": "請稍候", "emoji-no-recent": "還沒有最近使用的表情符號", "emoji-search-description": "搜尋和複製表情符號" - }, - "result": "筆結果", - "results": "筆結果" + } }, "lock-screen": { "authenticating": "驗證中...", diff --git a/Commons/I18n.qml b/Commons/I18n.qml index 2045f053f..f05ccb59b 100644 --- a/Commons/I18n.qml +++ b/Commons/I18n.qml @@ -343,18 +343,15 @@ Singleton { // ------------------------------------------- // Plural translation function - function trp(key, count, defaultSingular, defaultPlural, interpolations) { - if (typeof defaultSingular === "undefined") - defaultSingular = ""; - if (typeof defaultPlural === "undefined") - defaultPlural = ""; - if (typeof interpolations === "undefined") + function trp(key, count, interpolations) { + if (typeof interpolations === "undefined") { interpolations = {}; + } - const pluralKey = count === 1 ? key : `${key}-plural`; - const defaultValue = count === 1 ? defaultSingular : defaultPlural; + // Use key for singular, key-plural for plural + const realKey = count === 1 ? key : `${key}-plural`; - // Merge interpolations with count (QML doesn't support spread operator) + // Merge interpolations with count var finalInterpolations = { "count": count }; @@ -362,6 +359,6 @@ Singleton { finalInterpolations[prop] = interpolations[prop]; } - return tr(pluralKey, finalInterpolations); + return tr(realKey, finalInterpolations); } } diff --git a/Modules/Panels/Launcher/Launcher.qml b/Modules/Panels/Launcher/Launcher.qml index 712398c29..6e5370e49 100644 --- a/Modules/Panels/Launcher/Launcher.qml +++ b/Modules/Panels/Launcher/Launcher.qml @@ -1629,7 +1629,7 @@ SmartPanel { return ""; } var prefix = activeProvider && activeProvider.name ? activeProvider.name + ": " : ""; - return prefix + results.length + " " + (results.length === 1 ? I18n.tr("launcher.result") : I18n.tr("launcher.results")); + return prefix + I18n.trp("common.result-count", results.length); } pointSize: Style.fontSizeXS color: Color.mOnSurfaceVariant diff --git a/Services/Noctalia/PluginService.qml b/Services/Noctalia/PluginService.qml index f3930994b..2196b7547 100644 --- a/Services/Noctalia/PluginService.qml +++ b/Services/Noctalia/PluginService.qml @@ -1005,19 +1005,13 @@ Singleton { // ---------------------------------------- // Plural translation function - api.trp = function (key, count, defaultSingular, defaultPlural, interpolations) { - if (typeof defaultSingular === 'undefined') { - defaultSingular = ''; - } - if (typeof defaultPlural === 'undefined') { - defaultPlural = ''; - } + api.trp = function (key, count, interpolations) { if (typeof interpolations === 'undefined') { interpolations = {}; } - // Use key for singular, key_plural for plural - var pluralKey = count === 1 ? key : key + '-plural'; + // Use key for singular, key-plural for plural + const realKey = count === 1 ? key : `${key}-plural`; // Merge interpolations with count var finalInterpolations = { @@ -1028,7 +1022,7 @@ Singleton { } // Use tr() to look up the translation - return api.tr(pluralKey, finalInterpolations); + return api.tr(realKey, finalInterpolations); }; // ---------------------------------------- @@ -1272,27 +1266,25 @@ Singleton { if (updateCount > 0) { Logger.i("PluginService", updateCount, "plugin update(s) available"); - ToastService.showNotice(I18n.tr("panels.plugins.title"), I18n.trp("panels.plugins.update-available", updateCount, "{count} plugin update available:", "{count} plugin updates available:", { - "count": updateCount - }) + "\n\n" + updatesDescription, "plugin", 5000, I18n.tr("panels.plugins.open-plugins-tab"), function () { - // Open settings panel to Plugins tab on the screen where the cursor is - if (root.screenDetector) { - root.screenDetector.withCurrentScreen(function (screen) { - var panel = PanelService.getPanel("settingsPanel", screen); - if (panel) { - panel.requestedTab = SettingsPanel.Tab.Plugins; - panel.open(); - } - }); - } else { - // Fallback to primary screen if screen detector is not available - var panel = PanelService.getPanel("settingsPanel", Quickshell.screens[0]); - if (panel) { - panel.requestedTab = SettingsPanel.Tab.Plugins; - panel.open(); - } - } - }); + ToastService.showNotice(I18n.tr("panels.plugins.title"), I18n.trp("panels.plugins.update-available", updateCount) + "\n\n" + updatesDescription, "plugin", 5000, I18n.tr("panels.plugins.open-plugins-tab"), function () { + // Open settings panel to Plugins tab on the screen where the cursor is + if (root.screenDetector) { + root.screenDetector.withCurrentScreen(function (screen) { + var panel = PanelService.getPanel("settingsPanel", screen); + if (panel) { + panel.requestedTab = SettingsPanel.Tab.Plugins; + panel.open(); + } + }); + } else { + // Fallback to primary screen if screen detector is not available + var panel = PanelService.getPanel("settingsPanel", Quickshell.screens[0]); + if (panel) { + panel.requestedTab = SettingsPanel.Tab.Plugins; + panel.open(); + } + } + }); } else if (pendingCount > 0) { Logger.i("PluginService", pendingCount, "plugin update(s) pending (require newer Noctalia)"); } else { From 87a77fc446f4422eb701bc7f6a69bccbda0334be Mon Sep 17 00:00:00 2001 From: Lemmy Date: Fri, 23 Jan 2026 09:06:37 -0500 Subject: [PATCH 2/2] launcher: minor ref fix --- Modules/Panels/Launcher/Launcher.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Panels/Launcher/Launcher.qml b/Modules/Panels/Launcher/Launcher.qml index 6e5370e49..745152967 100644 --- a/Modules/Panels/Launcher/Launcher.qml +++ b/Modules/Panels/Launcher/Launcher.qml @@ -1476,7 +1476,7 @@ SmartPanel { icon: modelData.icon pointSize: Style.fontSizeXXXL visible: modelData.icon && !modelData.displayString - color: (entry.isSelected && !Settings.data.appLauncher.showIconBackground) ? Color.mOnHover : Color.mOnSurface + color: (gridEntryContainer.isSelected && !Settings.data.appLauncher.showIconBackground) ? Color.mOnHover : Color.mOnSurface } }