Skip to content

docs: publish a Traditional Chinese site as a Read the Docs translation - #146

Merged
allen0099 merged 1 commit into
masterfrom
docs/zh-tw-site-infra
Sep 25, 2026
Merged

allen0099 merged 1 commit into
masterfrom
docs/zh-tw-site-infra

Conversation

@allen0099

Copy link
Copy Markdown
Owner

Part of #89 (PR 1 of 3: infrastructure).

What

  • zensical.zh-TW.toml builds a separate zh-TW site from i18n/zh-TW/docs/ into site-zh-TW/. The site uses theme.language = "zh-Hant" and the same markdown extensions as the English site, without mkdocstrings. Pages that aren't translated yet are linked from its navigation to the English site.
  • Why i18n/zh-TW/ and not docs/zh-TW/: Zensical silently ignores exclude_docs, so anything under docs/ would also be built into the English site.
  • Language switcher: both configs set extra.alternate (English ↔ 繁體中文).
  • "May be outdated" banner: i18n/zh-TW/overrides/main.html fills the theme's announce block on every page. The banner links to the same page on the English site (config.extra.english_site + page.url). English is the source of truth.
  • Read the Docs: i18n/zh-TW/.readthedocs.yaml is the root config with -f zensical.zh-TW.toml and site-zh-TW/ as the output.
  • CI: the Docs workflow also builds the zh-TW site with --strict, and its path filters include i18n/** and zensical.zh-TW.toml.
  • i18n/zh-TW/docs/index.md: a translation of the current English README, which replaces the outdated docs/README.zh-TW.md (deleted). The README's 繁體中文 link now points there.
  • i18n/zh-TW/GLOSSARY.md: Taiwan terminology. Code, parameter and header names stay untranslated.
  • docs/DEVELOPMENT.md (new "Traditional Chinese translation" section) and docs/CONTRIBUTING.md state the sync policy: contributors update the English pages only, and the translation may lag.

No CHANGELOG entry: nothing in the library changes.

Maintainer setup on Read the Docs (manual, after merge)

  1. Create a project fastapi-cachex-zh-tw from this repository.
    • Language: Traditional Chinese (zh-tw).
    • Advanced settings → Build configuration file: i18n/zh-TW/.readthedocs.yaml.
  2. In the main project, go to Settings → Translations and add fastapi-cachex-zh-tw. It will then be served at https://fastapi-cachex.readthedocs.io/zh-tw/latest/.

Until then the switcher's 繁體中文 entry leads to a 404.

Verified

  • zensical build --strict and zensical build --strict -f zensical.zh-TW.toml both report no issues.
  • The zh-TW HTML has lang="zh-Hant", the banner and switcher links on every page, and the external nav entries.
  • A throwaway page HTTP_CACHING.md got a banner linking to /en/latest/HTTP_CACHING/.

The Chinese README lived under docs/ and duplicated the English front page
without being part of the site. Replace it with a separate zh-TW site built
from zensical.zh-TW.toml out of i18n/zh-TW/docs/ (Zensical has no
exclude_docs, so it cannot live under docs/), published as a Read the Docs
translation project at /zh-tw/latest/.

- Both sites get a language switcher (extra.alternate).
- Every translated page carries a banner saying English is the source of
  truth, linking to the page's English original.
- Untranslated guides are linked from the zh-TW navigation to the English
  site; later PRs swap them for translations.
- The Docs workflow builds both sites strictly.
- DEVELOPMENT.md and CONTRIBUTING.md describe the translation and its sync
  policy; i18n/zh-TW/GLOSSARY.md fixes the terminology.

Part of #89
@allen0099
allen0099 merged commit 2e87571 into master Sep 25, 2026
2 checks passed
@allen0099
allen0099 deleted the docs/zh-tw-site-infra branch September 26, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant