Skip to content

Commit 4c0a8bb

Browse files
committed
Extend the translated docs to twelve languages
Adds Deutsch, español, français, हिन्दी, русский, Türkçe, українська and 繁體中文 alongside the existing four, using the same language codes and switcher labels ("de - Deutsch") as other Python documentation sites; zh-CN and pt-BR become zh and pt (Brazilian Portuguese). Each new language gets its instructions and glossary plus a full set of generated pages. The language switcher now keeps you on the current page when you change language instead of returning to the home page.
1 parent 6107a94 commit 4c0a8bb

539 files changed

Lines changed: 58711 additions & 30 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/js/language-switch.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// The theme links each language-switcher entry to that language's home page.
2+
// Point the entries at the current page on each language's site instead: every
3+
// prose page exists at the same path on all of them. The API reference is
4+
// English-only, so from there the entries keep pointing at the site roots.
5+
// Instant navigation swaps the page but keeps the header, so re-run on every
6+
// page the theme loads (`document$`) rather than once.
7+
const base = JSON.parse(document.getElementById("__config").textContent).base;
8+
// The site root as a directory path; `base` lacks the trailing slash on 404 pages.
9+
const site = new URL(base.replace(/\/?$/, "/"), location).pathname;
10+
11+
document$.subscribe(() => {
12+
let page = location.pathname.slice(site.length);
13+
if (page.startsWith("api/")) page = "";
14+
for (const entry of document.querySelectorAll(".md-select__link[hreflang]")) {
15+
entry.dataset.site ??= entry.getAttribute("href"); // the language root the theme rendered
16+
entry.href = entry.dataset.site + page;
17+
}
18+
});

docs/translations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This documentation is written in English. To make it useful to more people, we a
44

55
## What's available
66

7-
Translated documentation is currently a **preview** in four languages: Chinese (Simplified), Japanese, Korean and Portuguese (Brazil). Pick one from the language switcher at the top of any page. More languages may follow once these have proved themselves.
7+
Translated documentation is currently a **preview** in twelve languages: Deutsch, español, français, हिन्दी, 日本語, 한국어, português (Brasil), русский язык, Türkçe, українська мова, 简体中文 and 繁體中文. Pick one from the language switcher at the top of any page. More languages may follow once these have proved themselves.
88

99
The API reference is not translated: the translated site links to the single English one.
1010

i18n/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ uv run --frozen python scripts/docs/translations.py stage --lang CODE
1717

1818
`status` is offline: per language it lists missing, outdated (with the sections that changed), current and removable pages (translations whose English page is gone — `git rm` them). `translate` calls the Claude API (`ANTHROPIC_API_KEY` in the environment; the registry's model, or `DOCS_TRANSLATE_MODEL` to trial another) for the missing and outdated pages, retranslating only the English sections that changed and keeping the rest byte for byte; `--pages` instead re-translates exactly the named pages from scratch, which is also how a glossary or instructions change reaches existing pages (each generated page records the English section hashes it reflects, so editing those inputs invalidates nothing). `stage` assembles the tree a language site is built from; `scripts/docs/build.sh` runs it for every language. Commit the generated pages in an ordinary pull request.
1919

20-
To add a language, add an entry to `languages.yml`, write `<code>/instructions.md` (the sections the pt-BR file has) and `<code>/glossary.json`, then run `translate --lang <code>`.
20+
To add a language, add an entry to `languages.yml`, write `<code>/instructions.md` (the sections the `pt` file has) and `<code>/glossary.json`, then run `translate --lang <code>`.

i18n/de/glossary.json

Lines changed: 296 additions & 0 deletions
Large diffs are not rendered by default.

i18n/de/instructions.md

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
# German (de) — translation instructions
2+
3+
Target language: German in Germany's standard orthography (Deutsch, de-DE),
4+
directory and URL code `de`, page language tag `de`. This file is sent verbatim
5+
with every translation request for this language, on top of the shared rules
6+
in `../general-prompt.md`. The termbase in `glossary.json` is sent alongside it
7+
and wins any terminology conflict with this file.
8+
9+
## 1. Register
10+
11+
Address the reader as **du**, consistently — the register of modern open-source
12+
and developer-tool documentation; Sie would read like vendor docs.
13+
14+
- du, dich, dir, dein are lower-case mid-sentence. Never address the reader as
15+
Sie / Ihnen / Ihr, never capitalised Du / Dein, never a mix — a page that
16+
drifts between du and Sie, or between direct imperatives and impersonal
17+
officialese, is wrong even when each sentence is acceptable on its own.
18+
(Third-person sie and a sentence-initial Sie are ordinary German and fine.)
19+
- Steps are bare du imperatives: "Install the SDK, then run the server" →
20+
Installiere das SDK und starte dann den Server — not Installieren Sie …, not
21+
the infinitive SDK installieren in running prose, not Du solltest … (needless
22+
modal), no bitte per step. Impersonal man only for truly general statements.
23+
Where English says "your", German often uses the article: öffne das Terminal.
24+
- Headings, table headers, tab labels and admonition titles are noun phrases or
25+
infinitive constructions, never imperatives: "Declare a tool" → Ein Tool
26+
deklarieren, "Handling errors" → Fehler behandeln, "Running your server" →
27+
Den Server betreiben, "The Context" → Der Context. A question heading may
28+
stay a question (Wohin damit?). No full stop after a heading.
29+
- Requirement strength stays exact: must → muss, should → sollte, may / can →
30+
kann or darf, must not → darf nicht (muss nicht means "need not").
31+
- Gender-neutral wording by phrasing, never by typography. Sentences about the
32+
reader (du) or about software (der Client, der Server) need nothing. For
33+
people use plurals and neutral nouns — alle, die den Host bedienen; wer das
34+
SDK einsetzt; das Team — and for the single human in front of the host ("the
35+
user") die Person, or die Person am Host where the role needs naming, then
36+
sie. Never Nutzer*innen, Nutzer:innen, NutzerInnen or Nutzer/-innen, and no
37+
bare generic masculine (der Nutzer, der Entwickler) either. Provisional;
38+
apply it uniformly.
39+
40+
## 2. Voice
41+
42+
The English source is warm, direct and confident: short sentences, the
43+
occasional one-line payoff. Carry that — sachlich, direkt, freundlich.
44+
45+
- Keep the payoff sentences short: "That's the whole API." → Das ist die ganze
46+
API. — not a formal summary sentence. Split long English sentences: two main
47+
clauses read better than one nested period with the verb parked at the end.
48+
Never merge, drop or reorder the technical claims themselves.
49+
- Verbs, not Nominalstil: die Durchführung der Installation erfolgt →
50+
installiere; eine Überprüfung vornehmen → prüfen. Active where German allows
51+
it: "The tool is called by the model" → Das Modell ruft das Tool auf.
52+
- No officialese (seitens, mittels, im Rahmen von, es ist darauf zu achten,
53+
dass, erfolgt as an all-purpose verb), no hype or softeners (leistungsstark,
54+
nahtlos, im Handumdrehen; du könntest eventuell → du kannst), no
55+
English-shaped German (Sinn machen → sinnvoll sein, Python's → Pythons, ist
56+
am Laufen → läuft). Nor the over-correction: no buddy tone (mega, easy).
57+
- Example — "You don't construct it and you don't configure it. You ask for
58+
it." → Du erzeugst ihn nicht selbst und konfigurierst ihn auch nicht. Du
59+
forderst ihn einfach an. (ihn: der Context.) Not the Nominalstil Eine
60+
Instanziierung sowie Konfiguration ist nicht erforderlich; es genügt eine
61+
Anforderung. — nor the slangy calque Du baust es nicht … fragst danach, easy!
62+
63+
## 3. Humour and idioms
64+
65+
- The English is friendly and dry rather than jokey; the warmth carries over
66+
into the du register unchanged, the idioms do not. Never translate a pun,
67+
idiom or aside literally: say what it means as a short, natural German
68+
sentence in the same register; a German idiom at home in technical prose is
69+
welcome (unter der Haube for "under the hood"). An aside with no information
70+
may go — a technical caveat phrased lightly never does.
71+
- Recurring English tags get fixed renderings: "**[X]()** has the whole story"
72+
/ "The whole story is in **[X]()**" → Alles Weitere steht in **[X]()**;
73+
"That's the whole API." / "That's the whole protocol." → Das ist die ganze
74+
API. / Das ist das ganze Protokoll.; "That's it. It's just Python." → Das ist
75+
alles. Ganz normales Python. (not Das ist es. Es ist nur Python!); "You get
76+
`3` back. ✨" → Du bekommst `3` zurück. ✨ (not Du erhältst 3 zurück! ✨ —
77+
lost code span, added exclamation mark).
78+
- Idioms take the plain meaning, not the picture: "Out of the box the app
79+
answers **only** requests addressed to localhost." → Ohne weitere
80+
Konfiguration beantwortet die App **nur** Requests an localhost — not aus der
81+
Box heraus. "it stops being required" → er ist nicht mehr erforderlich, not
82+
er stoppt, required zu sein.
83+
- Exclamation marks: keep one only where the English carries genuine emphasis;
84+
never add, never double, never in a heading. Emoji: keep the source's rare,
85+
deliberately placed emoji exactly where they are; never add new ones.
86+
87+
## 4. Typography
88+
89+
- Quotation marks in prose are German „…“ (U+201E, U+201C), with ‚…‘ for a
90+
quote inside a quote. Straight "…" and English “…” in the source prose become
91+
„…“, scare quotes and example utterances included. Quotes inside code spans
92+
and code blocks stay exactly as they are, and a code span is never wrapped in
93+
quotation marks.
94+
- Dashes: an English em-dash aside becomes a Gedankenstrich — an en dash with a
95+
space on each side (Text – Einschub – Text) — or commas, parentheses or a
96+
second sentence; never an em dash (—) in German text. Ranges: 3.10 bis 3.14,
97+
or 3.10–3.14 with an en dash and no spaces.
98+
- Compounds are closed or hyphenated, never spaced. A compound with an English,
99+
abbreviated or code-font part is hyphenated through every joint: der
100+
MCP-Server, das JSON-RPC-Format, der Streamable-HTTP-Transport, das
101+
`Context`-Objekt, die `PATH`-Umgebungsvariable. Never MCP Server with a space
102+
(and `MCPServer` is a class, not ein MCP-Server). A multi-word English term
103+
standing alone stays open: Streamable HTTP, Dependency Injection.
104+
- Every noun is capitalised, borrowed ones included (der Request, das Tool);
105+
borrowed adjectives and verbs are not (optional, gecacht). Orthography is
106+
de-DE: dass, muss, schließen, außerdem — never Swiss ss.
107+
- Digits stay ASCII. Protocol revision strings such as `2026-07-28`, version
108+
numbers, ports, status and error codes, RFC and SEP numbers are identifiers,
109+
copied byte for byte — never 28.07.2026, never 28. Juli 2026. Prose
110+
quantities take the decimal comma only when nothing but the separator changes
111+
(2,5 Sekunden), never inside code; a space before units and % (30 s, 100 %).
112+
- Abbreviations: e.g. → z. B., i.e. → d. h., etc. → usw. (inner space kept);
113+
vs → oder / gegenüber; & in prose → und. Commas follow German grammar, not
114+
the source (before dass, weil, wenn, ob and relative clauses).
115+
- Bold and italics land on the words that carry the source's emphasis; a bolded
116+
negation ("**not**" → **nicht** / **kein**) stays bold. English words kept in
117+
German text are set in normal type.
118+
119+
## 5. Terminology pointer
120+
121+
The termbase is `glossary.json` next to this file. It is injected into the
122+
prompt separately and its renderings override anything written here. This
123+
section only fixes the conventions the glossary assumes:
124+
125+
- Terms in the glossary's `keep` list are copied exactly — same spelling and
126+
casing, not translated, italicised or quoted. They take an article by gender
127+
(das SDK, die API, das JSON, die URL, der URI, das CLI, das LLM, der SEP, der
128+
RFC) and the English plural where the source is plural (die SDKs).
129+
- Everything in code font — class, function, parameter and module names,
130+
protocol method strings (`tools/call`), header names, error text, config keys
131+
— stays byte-identical. Name the kind of thing in front where it helps (die
132+
Klasse `Context`, der Parameter `lifespan=`); compounds take a hyphen outside
133+
the backticks (der `Resolve`-Marker). A glossary term used as a code-font
134+
identifier stays English: "the `sampling` capability" → die Capability
135+
`sampling`.
136+
- Text quoted from what the example code prints or displays — an output line, a
137+
log message, an error string, a UI label such as the Inspector's **Tools**
138+
and **Resources** tabs — stays exactly as the code emits it (usually
139+
English), in or out of code font. The quotation marks around it may become
140+
„…“; the text inside does not change.
141+
- Nouns are borrowed, verbs are not. German developers keep many English nouns
142+
— capitalised, with a fixed gender, declined: der Request, die Response, der
143+
Client, der Server, der Host, der Handler, der Callback, das Tool, der
144+
Prompt, das Token, der String, der Header, die Payload, der Stream, das
145+
Schema, die Middleware, die Session, der Commit, der Build, das Deployment.
146+
Plurals take -s (die Requests, die Tools) except nouns in -er, which stay
147+
unchanged (die Server, die Handler, die Parameter). Verbs are German wherever
148+
a plain German verb exists: bereitstellen (not deployen), einen Commit
149+
anlegen (not committen), zusammenführen (not mergen), aktualisieren (not
150+
updaten). Fully naturalised verbs are fine: debuggen, parsen, loggen, cachen.
151+
- Translate where German developers use the German word themselves — a forced
152+
purism is as wrong as needless English: Ressource, Abhängigkeit, Fehler,
153+
Rückgabewert, Standardwert, Umgebungsvariable, Bibliothek, Verzeichnis,
154+
Verbindung, Benachrichtigung; but never Zeichenkette for String.
155+
- First-use gloss: a rendering the reader may need to map back to the English
156+
specification carries the English in parentheses on its first occurrence on
157+
a page — der Rückkanal (back-channel) — where the glossary note says so.
158+
- One rendering per term per page: the glossary target, every time. Where an
159+
entry's note marks the choice as open or provisional, still use the listed
160+
target consistently — never Request in one paragraph and Anfrage in the next.
161+
162+
## 6. Provisional note
163+
164+
The register, voice and terminology decisions above, and every entry in
165+
`glossary.json`, are provisional pending review by native German-speaking
166+
readers — in particular the du address, the gender-neutral phrasing convention
167+
and the keep-versus-translate line for individual nouns. To propose a change,
168+
edit this file or `glossary.json` in a pull request, ideally with a short
169+
good/bad example; never edit the generated `pages/` or `notices.md` next to
170+
this file, which the next translation run overwrites.

i18n/de/notices.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
translation:
3+
sections: [aff1b3e872b7876a, 4d80558ad052d586, 0bb81f1e62062d26, d5c35dcec50156bc]
4+
tool: 1
5+
---
6+
# Übersetzungshinweise {#translation-notices}
7+
8+
Einer dieser Hinweise steht oben auf jeder Seite einer übersetzten Dokumentationsseite.
9+
10+
## Maschinelle Übersetzung {#translated}
11+
12+
Diese Seite wurde automatisch aus der englischen Dokumentation übersetzt, und die [englische Seite](ENGLISH_PAGE) ist die maßgebliche Fassung. Wenn sich etwas falsch liest, erklärt [Übersetzungen](TRANSLATIONS_PAGE), wie du es melden kannst.
13+
14+
## Übersetzung hinter der englischen Seite zurück {#outdated}
15+
16+
Die englische Seite hat sich geändert, nachdem diese Übersetzung entstanden ist, daher können Teile davon veraltet sein. Lies im Zweifel die [englische Seite](ENGLISH_PAGE); [Übersetzungen](TRANSLATIONS_PAGE) erklärt, wie die übersetzte Dokumentation funktioniert.
17+
18+
## Auf Englisch angezeigt {#english}
19+
20+
Für diese Seite gibt es keine aktuelle Übersetzung, deshalb liest du sie auf Englisch. [Übersetzungen](TRANSLATIONS_PAGE) erklärt, wie die übersetzte Dokumentation funktioniert.

0 commit comments

Comments
 (0)