Date: 2026-01-11 01:55
Summary: Fixed header language fallback to use explicit /en/ so English switch works from /zh/.
[question] http://localhost:8787/zh/ 中下拉英语点击后,页面没有跳转到英语页面
[try to solve]
When langAlternates was missing, the language dropdown fell back to withLangPath(code, '/'). With default language en, that produced /, which could negotiate back to Chinese—so “English” looked like a no-op.
Fix: in scripts/site/components/header.mjs, use withExplicitLangPath(code, '/') for the fallback so even the default language gets an explicit path (e.g. /en/).
Re-ran env SITE_LANGS=zh,en SITE_DEFAULT_LANG=en npm run build:site and confirmed /zh/ includes href="/en/" for the switcher.
[actions]
- Updated:
scripts/site/components/header.mjs - Ran:
env SITE_LANGS=zh,en SITE_DEFAULT_LANG=en npm run build:site