docs: translated documentation sites and the tooling behind them - #3231
Draft
maxisbey wants to merge 3 commits into
Draft
docs: translated documentation sites and the tooling behind them#3231maxisbey wants to merge 3 commits into
maxisbey wants to merge 3 commits into
Conversation
A manually-run tool under scripts/docs/i18n translates prose pages and navigation labels into the languages registered in i18n/languages.yml, guided by per-language instruction files and glossaries, with structural and meaning checks before anything is written. The docs build stages each language into its own site under /<code>/ (English pages overlaid with the available translations plus status banners) with translated navigation and a language switcher. Human-authored inputs and generated output both live under i18n/; docs/translations.md explains the model to readers.
Heading ids are now written into the docs source instead of derived from the heading text, so links stay stable across rewording and across the translated sites, and scripts/docs/check_anchors.py keeps it that way. The ids match what the current site already renders. Also settles the Streamable HTTP capitalisation the corpus used inconsistently.
Machine-generated first pass over the landing page, first steps and elicitation pages plus the navigation labels, produced with scripts/docs/i18n. These are generated files: corrections go through the language's instructions/glossary and a regeneration, never by editing pages/ directly.
Contributor
📚 Documentation preview
|
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.
First of a small series that ships the SDK docs in other languages. This one
lays the groundwork and includes machine-translated preview sites for
Simplified Chinese, Japanese, Korean, and Brazilian Portuguese (a few pages
each to start), served at
/zh-CN/,/ja/,/ko/, and/pt-BR/next tothe English site. English stays the single source of truth; everything else is
generated and never hand-edited.
scripts/docs/i18nis a manually-run tool(
status,translate,check,verify,prune,stage). It splits apage into sections, translates only what changed, carries unchanged
sections forward byte-for-byte from the previous translation, validates
structure (headings/anchors, code, links, admonitions, tables, glossary
terms) with retries, and runs a second-model adversarial pass hunting
meaning inversions before a page is written. Per-language inputs live in
i18n/languages/<lang>/:instructions.md(register, voice, typography)and
glossary.json(termbase + keep-in-English list + banned renderings) arethe human-edited part;
pages/,nav.yml,state.jsonare generated.the instructions or glossary and regenerating; corrections then hold across
every page and every future run instead of being clobbered by the next one.
docs/translations.mdexplains this to readers, with an issue form forreports.
scripts/docs/build.shbuilds English, then each language:stage the tree (English overlaid with that language's translations, plus
status banners — machine-translated / possibly-behind-English / not yet
translated / English-only), generate its config (translated nav labels,
language switcher, hreflang alternates), build it strictly. Language sites
link the one English API reference rather than rebuilding it; four languages
add ~25s to the ~50s English build.
{#id},seeded from the ids the current build already renders, so no link changes)
and a check keeps it that way — that's what makes anchors stable across
languages and across heading rewording.
hashes it was translated from;
statusshows missing/outdated/current,checkvalidates offline without ever failing on staleness (stale pagesare bannered, not build errors), and a later PR adds the scheduled job that
keeps things fresh.
Intentional behavior changes
None to the SDK. Docs builds now also produce the four language sites, and
every prose heading in
docs/carries an explicit anchor.Notes for reviewers
i18n/general-prompt.md→i18n/languages/ja/instructions.md→docs/translations.md→i18n/README.md→ the sample pages underi18n/languages/*/pages/(thefirst real output — a couple of known slips are listed below and are
fixed via the correction loop, not by editing the pages) → the tool.
language-aware tokenisation (theme limitation); the tool prints no
token/cost usage yet; the semantic gate scored one actor-swap in a pt-BR
sample as a warning where it should have blocked, so its calibration gets a
pass; a couple of register slips in the samples (ja italics on emphasis,
two pt-BR pronouns) become instruction-file rules.
translationlabel the issue form applies.ANTHROPIC_API_KEY(or an authtoken); nothing in CI calls the API in this PR.
AI Disclaimer