Update localization files for backup destinations and API client credentials

- Changed references from E3 to S3 in Russian, Simplified Chinese, and Traditional Chinese localization files.
- Updated the corresponding keys and descriptions to reflect the change in backup destination protocols.
- Improved the Vite configuration to dynamically match locale files, simplifying the code for locale handling.
This commit is contained in:
shuaiplus
2026-04-30 15:03:05 +08:00
parent 9c5fbda374
commit 0c00114cc8
19 changed files with 1232 additions and 201 deletions
+17 -8
View File
@@ -1,4 +1,9 @@
export type Locale = 'en' | 'zh-CN' | 'zh-TW' | 'ru';
export type Locale =
| 'en'
| 'zh-CN'
| 'zh-TW'
| 'ru'
| 'es';
const LOCALE_STORAGE_KEY = 'nodewarden.locale';
@@ -9,6 +14,7 @@ export const AVAILABLE_LOCALES: readonly { value: Locale; label: string }[] = [
{ value: 'zh-CN', label: '简体中文' },
{ value: 'zh-TW', label: '繁體中文' },
{ value: 'ru', label: 'Русский' },
{ value: 'es', label: 'Español' },
];
let locale: Locale = resolveInitialLocale();
@@ -33,22 +39,25 @@ function resolveInitialLocale(): Locale {
if (normalized === 'zh-tw' || normalized === 'zh-hk' || normalized === 'zh-mo' || normalized.includes('hant')) return 'zh-TW';
if (normalized.startsWith('zh')) return 'zh-CN';
if (normalized.startsWith('ru')) return 'ru';
if (normalized.startsWith('es')) return 'es';
}
}
return 'en';
}
const localeLoaders: Record<Locale, () => Promise<{ default: MessageTable }>> = {
en: () => import('./i18n/locales/en'),
'zh-CN': () => import('./i18n/locales/zh-CN'),
'zh-TW': () => import('./i18n/locales/zh-TW'),
ru: () => import('./i18n/locales/ru'),
es: () => import('./i18n/locales/es'),
};
async function loadLocaleMessages(next: Locale): Promise<MessageTable> {
const cached = loadedMessages.get(next);
if (cached) return cached;
const mod = next === 'zh-CN'
? await import('./i18n/locales/zh-CN')
: next === 'zh-TW'
? await import('./i18n/locales/zh-TW')
: next === 'ru'
? await import('./i18n/locales/ru')
: await import('./i18n/locales/en');
const mod = await localeLoaders[next]();
loadedMessages.set(next, mod.default);
return mod.default;
}