feat(i18n): add zh-CN locale support (#1822)

* feat(i18n): add zh-cn locale support with Starlight routing

Reorganize Chinese translations from docs_cn/ into docs/zh-cn/
following Starlight's i18n content structure. Configure Starlight
with root locale (en, unprefixed) and zh-cn (/zh-cn/ prefix).

- Move 28 files from docs_cn/*_cn.md to docs/zh-cn/*.md
- Fix 21 internal links to remove _cn suffixes
- Add defaultLocale + locales config to astro.config.mjs
- Add .gitignore exception for docs/zh-cn/ (overrides z*/ rule)
- Language switcher activates automatically via existing Header
- hreflang tags auto-generated by Starlight on all pages

* feat(i18n): add zh-CN UI translations and sidebar labels

- Add website/src/content/i18n/zh-CN.json with Starlight UI strings
- Add sidebar group label translations (欢迎, 路线图, 教程, etc.)
- Register i18n collection in content config to fix deprecation warning

* fix(i18n): exclude 404 pages from sitemap

Custom 404 pages (root and zh-cn) were indexed as regular content in
the sitemap. Add a filter to the @astrojs/sitemap integration that
matches the /404 path segment precisely via regex on the URL pathname.
This commit is contained in:
Alex Verkhovsky 2026-03-06 19:21:43 -07:00 committed by GitHub
parent f7846fd5eb
commit ed76f57a19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 76 additions and 25 deletions

1
.gitignore vendored
View File

@ -40,6 +40,7 @@ CLAUDE.local.md
.agents/
z*/
!docs/zh-cn/
_bmad
_bmad-output

View File

@ -6,4 +6,4 @@ template: splash
您查找的页面不存在或已被移动。
[返回首页](./index_cn.md)
[返回首页](./index.md)

View File

@ -15,7 +15,7 @@ sidebar:
- 您希望智能体在每次启动时执行特定操作
:::note[前置条件]
- 在项目中安装了 BMad参见[如何安装 BMad](./install-bmad_cn.md)
- 在项目中安装了 BMad参见[如何安装 BMad](./install-bmad.md)
- 用于编辑 YAML 文件的文本编辑器
:::

View File

@ -44,7 +44,7 @@ sidebar:
你可以查看和完善生成的文件,或者如果你更喜欢,可以在 `_bmad-output/project-context.md` 手动创建它。
[了解更多关于项目上下文](../explanation/project-context_cn.md)
[了解更多关于项目上下文](../explanation/project-context.md)
## 步骤 3维护高质量项目文档
@ -113,8 +113,8 @@ UX 工作是可选的。决定不取决于你的项目是否有 UX而取决
## 更多信息
- **[快速修复](./quick-fixes_cn.md)** - 错误修复和临时变更
- **[既有项目 FAQ](../explanation/established-projects-faq_cn.md)** - 关于在既有项目上工作的常见问题
- **[快速修复](./quick-fixes.md)** - 错误修复和临时变更
- **[既有项目 FAQ](../explanation/established-projects-faq.md)** - 关于在既有项目上工作的常见问题
---
## 术语说明

View File

@ -7,7 +7,7 @@ sidebar:
使用 `npx bmad-method install` 命令在项目中设置 BMad并选择你需要的模块和 AI 工具。
如果你想使用非交互式安装程序并在命令行中提供所有安装选项,请参阅[本指南](./non-interactive-installation_cn.md)。
如果你想使用非交互式安装程序并在命令行中提供所有安装选项,请参阅[本指南](./non-interactive-installation.md)。
## 何时使用
@ -94,7 +94,7 @@ your-project/
**安装程序抛出错误**——将输出复制粘贴到你的 AI 助手中,让它来解决问题。
**安装程序工作正常但后续出现问题**——你的 AI 需要 BMad 上下文才能提供帮助。请参阅[如何获取关于 BMad 的答案](./get-answers-about-bmad_cn.md)了解如何将你的 AI 指向正确的来源。
**安装程序工作正常但后续出现问题**——你的 AI 需要 BMad 上下文才能提供帮助。请参阅[如何获取关于 BMad 的答案](./get-answers-about-bmad.md)了解如何将你的 AI 指向正确的来源。
---
## 术语说明

View File

@ -132,8 +132,8 @@ sections_completed: ['technology_stack', 'critical_rules']
## 后续步骤
- [**项目上下文说明**](../explanation/project-context_cn.md) — 了解其工作原理
- [**工作流程图**](../reference/workflow-map_cn.md) — 查看哪些工作流程加载项目上下文
- [**项目上下文说明**](../explanation/project-context.md) — 了解其工作原理
- [**工作流程图**](../reference/workflow-map.md) — 查看哪些工作流程加载项目上下文
---
## 术语说明

View File

@ -115,7 +115,7 @@ DEV 智能体也适用于探索不熟悉的代码。在新的聊天中加载它
## 何时升级到正式规划
在以下情况下考虑使用 [Quick Flow](../explanation/quick-flow_cn.md) 或完整的 BMad Method
在以下情况下考虑使用 [Quick Flow](../explanation/quick-flow.md) 或完整的 BMad Method
- 更改影响多个系统或需要在许多文件中进行协调更新
- 你不确定范围,需要规范来理清思路

View File

@ -22,7 +22,7 @@ sidebar:
### 1. 运行安装程序
按照[安装程序说明](./install-bmad_cn.md)操作。
按照[安装程序说明](./install-bmad.md)操作。
### 2. 处理旧版安装

View File

@ -15,8 +15,8 @@ BMad 方法(**B**reakthrough **M**ethod of **A**gile AI **D**riven Development
理解 BMad 的最快方式是亲自尝试。
- **[BMad 入门指南](./tutorials/getting-started_cn.md)** — 安装并了解 BMad 的工作原理
- **[工作流地图](./reference/workflow-map_cn.md)** — BMM 阶段、工作流和上下文管理的可视化概览
- **[BMad 入门指南](./tutorials/getting-started.md)** — 安装并了解 BMad 的工作原理
- **[工作流地图](./reference/workflow-map.md)** — BMM 阶段、工作流和上下文管理的可视化概览
:::tip[只想直接上手?]
安装 BMad 并运行 `/bmad-help` — 它会根据您的项目和已安装的模块引导您完成所有操作。
@ -57,7 +57,7 @@ BMad 可与任何支持自定义系统提示词或项目上下文的 AI 编码
## 下一步
准备开始了吗?**[BMad 入门指南](./tutorials/getting-started_cn.md)** 并构建您的第一个项目。
准备开始了吗?**[BMad 入门指南](./tutorials/getting-started.md)** 并构建您的第一个项目。
---
## 术语说明

View File

@ -83,7 +83,7 @@ BMad 提供两种开始工作的方式,它们服务于不同的目的。
| `/bmad-agent-bmm-architect` | Winston架构师 | 设计系统架构 |
| `/bmad-agent-bmm-sm` | BobScrum Master | 管理冲刺和故事 |
参见[智能体](./agents_cn.md)获取默认智能体及其触发器的完整列表。
参见[智能体](./agents.md)获取默认智能体及其触发器的完整列表。
### 工作流命令
@ -97,7 +97,7 @@ BMad 提供两种开始工作的方式,它们服务于不同的目的。
| `/bmad-bmm-code-review` | 运行代码审查 |
| `/bmad-bmm-quick-spec` | 定义临时更改(快速流程) |
参见[工作流地图](./workflow-map_cn.md)获取按阶段组织的完整工作流参考。
参见[工作流地图](./workflow-map.md)获取按阶段组织的完整工作流参考。
### 任务和工具命令
@ -140,7 +140,7 @@ BMad 提供两种开始工作的方式,它们服务于不同的目的。
| `bmad-<module>-<workflow>` | 工作流命令 | `bmad-bmm-create-prd` |
| `bmad-<name>` | 核心任务或工具 | `bmad-help` |
模块代码:`bmm`(敏捷套件)、`bmb`(构建器)、`tea`(测试架构师)、`cis`(创意智能)、`gds`(游戏开发工作室)。参见[模块](./modules_cn.md)获取描述。
模块代码:`bmm`(敏捷套件)、`bmb`(构建器)、`tea`(测试架构师)、`cis`(创意智能)、`gds`(游戏开发工作室)。参见[模块](./modules.md)获取描述。
## 故障排除

View File

@ -103,7 +103,7 @@ Quinn 的 Automate 工作流出现在 BMad 方法工作流图的第 4 阶段(
Quinn 直接从源代码工作无需加载规划文档PRD、架构。TEA 工作流可以与上游规划产物集成以实现可追溯性。
有关测试在整体流程中的位置,请参阅[工作流图](./workflow-map_cn.md)。
有关测试在整体流程中的位置,请参阅[工作流图](./workflow-map.md)。
---
## 术语说明

View File

@ -86,7 +86,7 @@ BMad MethodBMM是 BMad 生态系统中的一个模块,旨在遵循上下
- **手动** — 使用您的技术栈和实施规则创建 `_bmad-output/project-context.md`
- **生成它** — 运行 `/bmad-bmm-generate-project-context` 以从您的架构或代码库自动生成
[**了解更多关于 project-context.md**](../explanation/project-context_cn.md)
[**了解更多关于 project-context.md**](../explanation/project-context.md)
---
## 术语说明

View File

@ -73,7 +73,7 @@ BMad 通过带有专门 AI 智能体的引导工作流帮助你构建软件。
| 3 | 解决方案设计 | 设计架构 *(仅限 BMad Method/Enterprise only* |
| 4 | 实现 | 逐个史诗、逐个故事地构建 |
**[打开工作流地图](../reference/workflow-map_cn.md)** 以探索阶段、工作流和上下文管理。
**[打开工作流地图](../reference/workflow-map.md)** 以探索阶段、工作流和上下文管理。
根据项目的复杂性BMad 提供三种规划路径:
@ -126,7 +126,7 @@ BMad-Help 将检测你已完成的内容,并准确推荐下一步该做什么
:::tip[项目上下文(可选)]
在开始之前,考虑创建 `project-context.md` 来记录你的技术偏好和实现规则。这确保所有 AI 智能体在整个项目中遵循你的约定。
`_bmad-output/project-context.md` 手动创建它,或在架构之后使用 `/bmad-bmm-generate-project-context` 生成它。[了解更多](../explanation/project-context_cn.md)。
`_bmad-output/project-context.md` 手动创建它,或在架构之后使用 `/bmad-bmm-generate-project-context` 生成它。[了解更多](../explanation/project-context.md)。
:::
### 阶段 1分析可选

View File

@ -36,11 +36,28 @@ export default defineConfig({
},
integrations: [
sitemap(),
// Exclude custom 404 pages (all locales) from the sitemap — they are
// treated as normal content docs by Starlight even with disable404Route.
sitemap({
filter: (page) => !/\/404(\/|$)/.test(new URL(page).pathname),
}),
starlight({
title: 'BMAD Method',
tagline: 'AI-driven agile development with specialized agents and workflows that scale from bug fixes to enterprise platforms.',
// i18n: English as root (no URL prefix), Chinese at /zh-cn/
defaultLocale: 'root',
locales: {
root: {
label: 'English',
lang: 'en',
},
'zh-cn': {
label: '简体中文',
lang: 'zh-CN',
},
},
logo: {
light: './public/img/bmad-light.png',
dark: './public/img/bmad-dark.png',
@ -89,25 +106,29 @@ export default defineConfig({
// Sidebar configuration (Diataxis structure)
sidebar: [
{ label: 'Welcome', slug: 'index' },
{ label: 'Roadmap', slug: 'roadmap' },
{ label: 'Welcome', translations: { 'zh-CN': '欢迎' }, slug: 'index' },
{ label: 'Roadmap', translations: { 'zh-CN': '路线图' }, slug: 'roadmap' },
{
label: 'Tutorials',
translations: { 'zh-CN': '教程' },
collapsed: false,
autogenerate: { directory: 'tutorials' },
},
{
label: 'How-To Guides',
translations: { 'zh-CN': '操作指南' },
collapsed: true,
autogenerate: { directory: 'how-to' },
},
{
label: 'Explanation',
translations: { 'zh-CN': '概念说明' },
collapsed: true,
autogenerate: { directory: 'explanation' },
},
{
label: 'Reference',
translations: { 'zh-CN': '参考' },
collapsed: true,
autogenerate: { directory: 'reference' },
},

View File

@ -1,6 +1,7 @@
import { defineCollection } from 'astro:content';
import { docsSchema } from '@astrojs/starlight/schema';
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';
export const collections = {
docs: defineCollection({ schema: docsSchema() }),
i18n: defineCollection({ type: 'data', schema: i18nSchema() }),
};

View File

@ -0,0 +1,28 @@
{
"skipLink.label": "跳转到内容",
"search.label": "搜索",
"search.ctrlKey": "Ctrl",
"search.cancelLabel": "取消",
"themeSelect.accessibleLabel": "选择主题",
"themeSelect.dark": "深色",
"themeSelect.light": "浅色",
"themeSelect.auto": "自动",
"languageSelect.accessibleLabel": "选择语言",
"menuButton.accessibleLabel": "菜单",
"sidebarNav.accessibleLabel": "主导航",
"tableOfContents.onThisPage": "本页内容",
"tableOfContents.overview": "概述",
"i18n.untranslatedContent": "此内容尚未提供中文翻译。",
"page.editLink": "编辑页面",
"page.lastUpdated": "最后更新:",
"page.previousLink": "上一页",
"page.nextLink": "下一页",
"page.draft": "此内容为草稿,不会包含在正式版本中。",
"404.text": "页面未找到。请检查 URL 或尝试使用搜索。",
"aside.note": "注意",
"aside.tip": "提示",
"aside.caution": "警告",
"aside.danger": "危险",
"fileTree.directory": "目录",
"builtWithStarlight.label": "使用 Starlight 构建"
}