File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,15 +12,17 @@ export default function LanguageSwitcher() {
1212 const otherLocale = locale === 'en' ? 'zh' : 'en'
1313
1414 const switchLocale = ( ) => {
15- // Use push instead of replace for more reliable navigation
16- router . push ( pathname , { locale : otherLocale } )
15+ // 强制刷新页面切换语言
16+ const newPath = `/${ otherLocale } ${ pathname } `
17+ window . location . href = newPath
1718 }
1819
1920 return (
2021 < button
2122 onClick = { switchLocale }
22- className = "px-3 py-1.5 rounded-m3-sm bg-surface-container border border-outline-variant text-onsurface- variant hover:text-onsurface hover:border-primary/50 transition-colors text-[14px] font-medium cursor-pointer"
23+ className = "px-3 py-1.5 rounded-lg bg-surface-container border border-outline-variant text-on-surface- variant hover:text-on-surface hover:border-primary/50 transition-all duration-200 text-sm font-medium cursor-pointer hover:scale-105 "
2324 aria-label = { `Switch to ${ otherLocale === 'en' ? 'English' : '中文' } ` }
25+ type = "button"
2426 >
2527 { t ( otherLocale ) }
2628 </ button >
You can’t perform that action at this time.
0 commit comments