Files
blog/.spec/specs/archive/2026-10-25_add-blog-i18n/tasks.md
wait4xandGLM-5.3 e185a292c8 feat(i18n): T6 真实翻译入仓与 Phase 3 收敛归档
- op-artalk 车道:6/6 篇 TMT 翻译入 posts-en(frontmatter 字节级透传),
  幂等复跑 0 API;修复 TMT 1800+ 字符包静默截断(limit 1600 + ratio
  检测 + 二分降级,mock 三场景)
- 标题首字母抛光;T8 staging 21 页 + rollback 绿 + halo 无恙
- spec_verify --all 八项同指纹 exit=0;check 一次收敛;归档

验证: 21 页 build exit 0;/en/ 文章页真实英文内容渲染
      (Under the Veil… 抽检);幂等 dry-run 6 skip 0 API

Spec: 2026-10-25_add-blog-i18n
Co-authored-by: GLM-5.3
2026-10-25 09:40:59 +08:00

3.0 KiB
Raw Permalink Blame History

Phase 3:双语骨架 + 腾讯 TMT 翻译管线 - 任务拆解

使用规则

  • 每个任务 boundary/verify 齐备;verify 首个反引号 span 为执行命令;迁移教训:verify 只读断言(不重跑生成器)

阶段一:实现

  • T1 astro i18n 配置 + locale 管道

    • claim: orchestrator
    • boundary: 只改 astro.config.mjs(i18n 段)与 src/lib/locale.ts(当前语言工具)
    • verify: pnpm astro build
  • T2 UI 字典 + 组件串接

    • depends-on: task_0001
    • claim: op-gitea(mesh 车道,预约 src/i18n/ 与 Footer/SearchDialog/gallery/moments/about)
    • 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 中英互跳)

    • 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 译文标注组件

    • 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
    • verify: pnpm astro build && test -f dist/en/index.html
  • T5 TMT 翻译管线

    • claim: op-artalk(mesh 车道,预约 scripts/translate/)
    • boundary: 新建 scripts/translate/{tencent_tmt.py,translate_posts.py}:TC3-HMAC-SHA256 签名(--selftest 模式打印中间量)、段落分块(<2000 字符)、frontmatter 透传(title 翻译、locked:true 跳过)、.en.md 生成到 content/posts-en/、原文哈希记录防重译;凭据从宿主 0600 文件读(标签 Secert* 容错);不碰 src/、astro 配置
    • verify: python3 scripts/translate/translate_posts.py --dry-run
  • T6 存量翻译执行 + 标注落页

    • depends-on: task_0004, task_0005
    • claim: op-artalk(执行)+ orchestrator(验收)
    • 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

    • depends-on: task_0004
    • claim: orchestrator
    • boundary: BaseLayout 注入 hreflang 双向;src/pages/en/rss.xml.ts;sitemap 配置 i18n
    • verify: pnpm astro build && grep -q hreflang dist/index.html && test -f dist/en/rss.xml
  • T8 构建验收 + staging

    • depends-on: task_0002, task_0003, task_0004, task_0006, task_0007
    • claim: orchestrator
    • boundary: build.sh 跑 staging;抽检 /en/ 三页(首页/一文/图库)渲染
    • verify: bash infra/deploy/build.sh && test -f ~/docker_apps/blog/www-staging/en/index.html

当前进度:由脚本计算,无需手动维护