feat(i18n): 增强管理端多语言支持,优化语言初始化与恢复逻辑
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user