i18n: localize runtime notification delivery

This commit is contained in:
VAIO73
2026-09-17 11:59:48 +02:00
parent da7bf37c07
commit dc283bed9a
12 changed files with 247 additions and 81 deletions
@@ -202,12 +202,19 @@ const AI_PROVIDERS = [
const NOTIFICATION_LANGUAGES = [
{ value: "en", label: "English" },
{ value: "de", label: "Deutsch" },
{ value: "es", label: "Español" },
{ value: "fr", label: "Français" },
{ value: "it", label: "Italiano" },
{ value: "pt", label: "Português" },
{ value: "sk", label: "Slovenčina" },
{ value: "sv", label: "Svenska" },
]
function normalizeNotificationLanguage(notificationLanguage?: string, legacyAiLanguage?: string): string {
if (notificationLanguage === "en" || notificationLanguage === "sk") return notificationLanguage
if (legacyAiLanguage === "en" || legacyAiLanguage === "sk") return legacyAiLanguage
const runtimeLanguages = new Set(NOTIFICATION_LANGUAGES.map(language => language.value))
if (notificationLanguage && runtimeLanguages.has(notificationLanguage)) return notificationLanguage
if (legacyAiLanguage && runtimeLanguages.has(legacyAiLanguage)) return legacyAiLanguage
return "en"
}