Complete client UI i18n migration

Adds client-side i18n support, language settings, translated UI copy, and locale parity coverage.
This commit is contained in:
chyendongnhanh338
2026-06-11 14:15:35 +08:00
committed by GitHub
parent 41cf070fd8
commit 08ebe5e7e1
199 changed files with 16426 additions and 1821 deletions
+26
View File
@@ -0,0 +1,26 @@
import type { SupportedLocale } from "./locales";
interface I18nLanguageController {
language?: string;
changeLanguage: (language: SupportedLocale) => Promise<unknown>;
}
type I18nErrorReporter = (message: string, error: unknown) => void;
export const reportI18nError: I18nErrorReporter = (message, error) => {
console.error(message, error);
};
export function ensureI18nLanguageForRender(
locale: SupportedLocale,
i18n: I18nLanguageController,
reportError: I18nErrorReporter = reportI18nError,
): void {
if (i18n.language === locale) {
return;
}
i18n
.changeLanguage(locale)
.catch((error) => reportError("[i18n] Failed to change language", error));
}