i18n: simplified trp

This commit is contained in:
Lemmy
2026-01-23 09:03:58 -05:00
parent cff5c1d092
commit 94a09484aa
18 changed files with 76 additions and 88 deletions
+3 -3
View File
@@ -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...",
+3 -4
View File
@@ -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...",
+3 -3
View File
@@ -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...",
+3 -3
View File
@@ -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...",
+3 -3
View File
@@ -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...",
+3 -3
View File
@@ -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": "認証中...",
+3 -3
View File
@@ -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...",
+3 -3
View File
@@ -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...",
+3 -3
View File
@@ -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...",
+3 -3
View File
@@ -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...",
+3 -3
View File
@@ -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": "Аутентификация...",
+3 -3
View File
@@ -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...",
+3 -3
View File
@@ -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": "Автентифікація...",
+3 -3
View File
@@ -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": "正在验证...",
+3 -3
View File
@@ -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": "驗證中...",
+7 -10
View File
@@ -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);
}
}
+1 -1
View File
@@ -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
+5 -13
View File
@@ -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,9 +1266,7 @@ 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 () {
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) {