[GH-2867] Wire mkdocs-static-i18n for Chinese documentation#2920
Merged
jiayuasu merged 1 commit intoapache:masterfrom May 7, 2026
Merged
[GH-2867] Wire mkdocs-static-i18n for Chinese documentation#2920jiayuasu merged 1 commit intoapache:masterfrom
jiayuasu merged 1 commit intoapache:masterfrom
Conversation
Add the i18n plugin scaffolding so the docs site can serve a Chinese (zh) version alongside English. The default locale stays English and untranslated pages fall back to English content automatically, so translation can land incrementally per section. - Register mkdocs-static-i18n in the docs dependency group - Configure suffix-mode i18n (file.zh.md) with reconfigure_material and reconfigure_search so the language switcher and search index pick up both locales - Translate top-level navigation labels (Install, Programming Guide, API, Community, etc.) for the zh build - Seed docs/index.zh.md so the Chinese tree builds with content Subsequent PRs translate individual sections (landing pages, setup, tutorial, API reference, community).
b4b349d to
9a39bf9
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Wires mkdocs-static-i18n into the MkDocs documentation build so the site can publish a Chinese (zh) locale alongside English using suffix-mode files (*.zh.md) with fallback to English when translations are missing.
Changes:
- Added
mkdocs-static-i18nto the docs dependency group inpyproject.toml. - Configured
mkdocs-static-i18ninmkdocs.yml(suffix structure, fallback enabled, Material + search reconfiguration) and providedzhnavigation label translations. - Seeded a Chinese homepage at
docs/index.zh.mdto ensure the/zh/tree builds with content.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pyproject.toml | Adds the i18n plugin dependency to the docs environment used by CI/local builds. |
| mkdocs.yml | Enables suffix-mode i18n, configures en/zh builds, and provides zh nav label translations. |
| docs/index.zh.md | Seeds initial Chinese homepage content so the zh locale has a concrete landing page. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Did you read the Contributor Guide?
Is this PR related to a ticket?
[GH-XXX] my subject. Part of Add Chinese version of the documentation #2867 (EPIC).What changes were proposed in this PR?
Phase 1 of the EPIC #2867 — wires up the
mkdocs-static-i18nplugin so the docs site can serve a Chinese (zh) version alongside English. The default locale stays English and pages without a*.zh.mdtranslation fall back to the English content automatically, so subsequent translation PRs can land incrementally per section.mkdocs-static-i18nin thedocsdependency group inpyproject.tomlmkdocs.yml(file.zh.mdnext tofile.md) withreconfigure_materialandreconfigure_searchso the language switcher appears in the header and search indexes both localeszhbuild vianav_translationsdocs/index.zh.mdso the Chinese tree builds with content; future PRs translate the restTranslation lands as a series of follow-up PRs (#2909-#2919), one per documentation section, so each PR stays small and reviewable. See #2867 for the full checklist.
How was this patch tested?
Built the docs locally with
uv sync --group docs && uv run mkdocs buildand verified:Translated 120 navigation elements to 'zh'site/contains the English tree at root and a parallelsite/zh/treesite/index.htmlcontains<link rel="alternate" hreflang="en">andhreflang="zh"tags (language switcher wired in the header)site/zh/index.htmlshows the Chinese announcement bullets fromindex.zh.mdsite/zh/sedonaspark/index.htmlfalls back to the English content (since nosedonaspark.zh.mdexists yet)site/zh/index.htmlnavigation shows translated labels (e.g. "安装", "编程指南", "发布说明")Did this PR include necessary documentation updates?
docs-overrides/main.html, not inindex.md, so they will appear in English on the/zh/homepage until Phase 2 ([GH-2867] Translate documentation landing pages to Chinese (Phase 2) #2909) makes the template locale-aware. Auto-generated content (Rpkgdownunderapi/rdocs, Python Sphinx underapi/pydocs, JavaDoc, ScalaDoc) stays English-only — those are produced from source comments, not Markdown.