1
0
forked from baron/baron-sso

adminfront 상단 화면 i18n 정리

This commit is contained in:
2026-05-18 13:14:19 +09:00
parent 279bfae9ec
commit 222dc6f4a4
16 changed files with 1090 additions and 67 deletions

View File

@@ -0,0 +1,32 @@
import { DEFAULT_LOCALE, LOCALE_STORAGE_KEY, type Locale } from "../../../common/core/i18n";
function isLocale(value: string): value is Locale {
return value === "ko" || value === "en";
}
export function getAdminLocale(): Locale {
if (typeof window === "undefined") {
return DEFAULT_LOCALE;
}
const stored = window.localStorage.getItem(LOCALE_STORAGE_KEY);
if (stored && isLocale(stored)) {
return stored;
}
const pathLocale = window.location.pathname.split("/")[1];
if (pathLocale && isLocale(pathLocale)) {
return pathLocale;
}
const browserLang = window.navigator.language.toLowerCase();
if (browserLang.startsWith("ko")) {
return "ko";
}
return DEFAULT_LOCALE;
}
export function getAdminDateLocale() {
return getAdminLocale() === "ko" ? "ko-KR" : "en-US";
}