mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-08-05 06:50:10 +00:00
Add German (de), French (fr), Italian (it), and Swedish (sv) initial translations (#303)
This commit is contained in:
+17
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user