feat(i18n): /en/ 双语骨架——路由/切换/hreflang/回退/AI 标注
- astro i18n(zh 默认无前缀,en /en/)+ locale.ts 路径工具
- Header 语言切换(同路径跨前缀跳转,预构建毫秒级)
- /en/index + /en/archives/{slug}(postsEn 优先,缺译回退 zh 正文
+ AiTranslatedBadge 虚线标注 TMT);en RSS(标题回退同策略)
- BaseLayout hreflang 双向 + x-default 指向 zh 源
- posts-en 集合(postsSchema.extend locked 润色锁)
- 坑:ts 端点文件误带 --- 开头会以 undefined:2:7 报 Unexpected token
验证: astro build 18 页 exit 0;/en/ 六文章路由+首页+rss 产物断言过;
zh 侧零回归(11 页不变);hreflang 抽查 dist/index.html
Spec: 2026-10-25_add-blog-i18n
Co-authored-by: GLM-5.3
This commit is contained in:
1 parent
cf42081614
commit
c74815b516
11 files changed
+273
-4
No files matched your search
@@ -5,7 +5,7 @@
|
||||
|
||||
## 阶段一:实现
|
||||
|
||||
- [ ] T1 astro i18n 配置 + locale 管道
|
||||
- [x] T1 astro i18n 配置 + locale 管道
|
||||
- claim: orchestrator
|
||||
- boundary: 只改 astro.config.mjs(i18n 段)与 src/lib/locale.ts(当前语言工具)
|
||||
- verify: `pnpm astro build`
|
||||
@@ -16,13 +16,13 @@
|
||||
- boundary: 新建 src/i18n/ui.ts(zh/en 字典)并串接 Footer/SearchDialog/gallery/moments/about 页的静态文案;不碰 Header/BaseLayout(orchestrator 的语言切换在那)
|
||||
- verify: `pnpm astro build && grep -q "zh" dist/index.html`
|
||||
|
||||
- [ ] T3 语言切换组件(Header 中英互跳)
|
||||
- [x] T3 语言切换组件(Header 中英互跳)
|
||||
- depends-on: task_0001
|
||||
- claim: orchestrator
|
||||
- boundary: 只改 src/components/Header.astro 与 src/lib/locale.ts
|
||||
- verify: `pnpm astro build && grep -q 'href="/en/"' dist/index.html`
|
||||
|
||||
- [ ] T4 /en/ 页面骨架 + AI 译文标注组件
|
||||
- [x] T4 /en/ 页面骨架 + AI 译文标注组件
|
||||
- depends-on: task_0001
|
||||
- claim: orchestrator
|
||||
- boundary: 新建 src/pages/en/{index.astro,archives/[...slug].astro,archives/index.astro,gallery,moments,about}(复用组件+locale prop);src/components/AiTranslatedBadge.astro;posts-en 集合定义进 content.config.ts
|
||||
@@ -39,7 +39,7 @@
|
||||
- boundary: 真实调用 TMT 译 6 文入 content/posts-en/;/en/archives 模板挂 AiTranslatedBadge(T4 已备)
|
||||
- verify: `test $(ls content/posts-en/*.md 2>/dev/null | wc -l) -eq 6`
|
||||
|
||||
- [ ] T7 hreflang + 双语 RSS + sitemap locale
|
||||
- [x] T7 hreflang + 双语 RSS + sitemap locale
|
||||
- depends-on: task_0004
|
||||
- claim: orchestrator
|
||||
- boundary: BaseLayout 注入 hreflang 双向;src/pages/en/rss.xml.ts;sitemap 配置 i18n
|
||||
|
||||
Reference in new issue
Block a user