This commit is contained in:
hailin 2025-04-21 01:24:41 +08:00
parent dba0371580
commit 6b450fc03a
1 changed files with 5 additions and 4 deletions

View File

@ -138,11 +138,12 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({}) => {
const locales = i18nConfig.locales
const defaultLocale = i18nConfig.defaultLocale
let locale = defaultLocale
let locale: (typeof locales)[number] = defaultLocale
// 动态判断首段是否是合法语言代码
if (locales.includes(pathSegments[0])) {
locale = pathSegments[0]
const segment = pathSegments[0] as (typeof locales)[number]
if (locales.includes(segment)) {
locale = segment
}
const loginPath = locale === defaultLocale ? "/login" : `/${locale}/login`