This commit is contained in:
parent
32a2ff8b0c
commit
b84e1dbb30
|
|
@ -17,7 +17,9 @@ export function LanguageSwitcher() {
|
|||
// 只在加载时检查,避免多次保存 cookie
|
||||
if (typeof window !== 'undefined') {
|
||||
const saved = localStorage.getItem('preferred-language')
|
||||
console.log('Read cookie from localstorage preferred-language=', saved)
|
||||
const isLocaleInPath = i18nConfig.locales.includes(currentLocale as any)
|
||||
console.log('i18nConfig.locales currentLocale=', currentLocale)
|
||||
|
||||
// 只有在 URL 中没有 locale 前缀时才进行处理
|
||||
if (!isLocaleInPath && saved !== currentLocale) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue