Add German (de), French (fr), Italian (it), and Swedish (sv) initial translations (#303)

This commit is contained in:
Domainmasteri
2026-07-11 17:06:41 +08:00
committed by GitHub
parent aae614a079
commit 9caa064488
6 changed files with 5821 additions and 1 deletions
+17 -1
View File
@@ -11,7 +11,11 @@ export type Locale =
| 'zh-TW'
| 'ru'
| 'es'
| 'fi';
| 'fi'
| 'de'
| 'fr'
| 'it'
| 'sv';
import enMessages from './i18n/locales/en';
const LOCALE_STORAGE_KEY = 'nodewarden.locale';
@@ -25,6 +29,10 @@ export const AVAILABLE_LOCALES: readonly { value: Locale; label: string }[] = [
{ value: 'ru', label: 'Русский' },
{ value: 'es', label: 'Español' },
{ value: 'fi', label: 'Suomi' },
{ value: 'de', label: 'Deutsch' },
{ value: 'fr', label: 'Français' },
{ value: 'it', label: 'Italiano' },
{ value: 'sv', label: 'Svenska' },
];
let locale: Locale = resolveInitialLocale();
@@ -51,6 +59,10 @@ function resolveInitialLocale(): Locale {
if (normalized.startsWith('ru')) return 'ru';
if (normalized.startsWith('es')) return 'es';
if (normalized.startsWith('fi')) return 'fi';
if (normalized.startsWith('de')) return 'de';
if (normalized.startsWith('fr')) return 'fr';
if (normalized.startsWith('it')) return 'it';
if (normalized.startsWith('sv')) return 'sv';
}
}
return 'en';
@@ -63,6 +75,10 @@ const localeLoaders: Record<Locale, () => Promise<{ default: MessageTable }>> =
ru: () => import('./i18n/locales/ru'),
es: () => import('./i18n/locales/es'),
fi: () => import('./i18n/locales/fi'),
de: () => import('./i18n/locales/de'),
fr: () => import('./i18n/locales/fr'),
it: () => import('./i18n/locales/it'),
sv: () => import('./i18n/locales/sv'),
};
function localeToHtmlLang(value: Locale): string {