diff --git a/components/utility/profile-settings.tsx b/components/utility/profile-settings.tsx index 958607a..2aedc8b 100644 --- a/components/utility/profile-settings.tsx +++ b/components/utility/profile-settings.tsx @@ -138,11 +138,12 @@ export const ProfileSettings: FC = ({}) => { 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`