feat(i18n): 增强管理端多语言支持,优化语言初始化与恢复逻辑

This commit is contained in:
2026-05-25 14:53:15 +08:00
parent ddedef824e
commit 84bf924378
4 changed files with 56 additions and 9 deletions

View File

@@ -69,7 +69,8 @@ export function adminHtmlLang(loc: AdminApiLocale): string {
return "en";
}
function readStoredUiLocale(): AdminApiLocale | null {
/** 读取用户上次选择的界面语言(无则 null */
export function getStoredAdminUiLocale(): AdminApiLocale | null {
if (typeof window === "undefined") {
return null;
}
@@ -104,7 +105,7 @@ export function hydrateAdminUiLocale(): AdminApiLocale | null {
if (typeof window === "undefined") {
return null;
}
const stored = readStoredUiLocale();
const stored = getStoredAdminUiLocale();
if (stored) {
setAdminRequestLocale(stored);
document.documentElement.lang = adminHtmlLang(stored);