Skip to content

Documentation in seven languages (fr, de, es, zh-Hans, ko, ja) - #48

Merged
tannevaled merged 1 commit into
mainfrom
docs/i18n
Oct 25, 2026
Merged

tannevaled merged 1 commit into
mainfrom
docs/i18n

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

The user asked where the language selection combo is: there was none. This adds fr, de, es, zh (Simplified Chinese, zh-Hans), ko and ja to the documentation, the same setup as go-widgets/docs.

  • Setup. languages: in hugo.yaml (each language listed under its own name: English, Français, Deutsch, Español, 简体中文, 한국어, 日本語), flags from lipis/flag-icons (MIT), the Hextra language switch in the navbar and at the foot of the sidebar, per-language strings in i18n/ (Hextra's zh-cn strings are copied to zh, whose key it does not match). English stays at the root of each version (/docs/0.9/cli/), the others live under their code (/docs/0.9/fr/cli/); the version selector and the gallery work in each (the gallery's words are translated, the decks' own titles are the English ones of their front matter).
  • Pages. All 13 translated, code, flags, directive names and file names unchanged. Each translated heading carries the English heading's {#anchor}, so a relref with a fragment lands on the same heading in every language.
  • CJK. layouts/baseof.html sets lang from the language's locale (zh-Hans), which Hextra's does not; CJK languages get font stacks that name the CJK system fonts after system-ui. Hextra's FlexSearch already tokenises CJK per character; searching a two-character term finds a page in zh, ja and ko (checked in headless Chrome). Result order is character-level, so a short term also lists loosely related pages.
  • tools/i18n (Go, stdlib only, with tests): the CI fails when a page of content/en is missing in a language of hugo.yaml or exists only in a translation; it warns when a translation changes code blocks, inline code, shortcodes, link targets or anchors (-strict fails on those too); -fix adds the anchors; -built public compares the built site's heading ids with the English ones (192 translated pages match).

Translated by model, with a Go check for everything that is not prose; a native review is welcome.

🤖 Generated with Claude Code

…hinese, Korean, Japanese

Languages are set up as in go-widgets/docs (languages: in hugo.yaml, flags,
the Hextra language switch, per-language strings in i18n/), with the switch
also in the navbar. English stays at the root of each version
(/docs/0.9/cli/), the others live under their code (/docs/0.9/fr/cli/); the
version selector and the gallery work in each. Chinese is Simplified
(zh-Hans): layouts/baseof.html sets lang from the language's locale, and the
CJK languages get system font stacks that name the CJK system fonts.

Every page is translated, code, flags, directive names and file names
unchanged. Each translated heading carries the English heading's {#anchor}, so
that links into a page reach the same place in every language.

tools/i18n (Go, stdlib only, with tests) fails the CI when a page of
content/en is missing in a language of hugo.yaml, or exists only in a
translation, warns when a translation changes code, shortcodes, link targets
or anchors, and compares the built site's heading ids with the English ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 721c5ac into main Oct 25, 2026
3 checks passed
@tannevaled
tannevaled deleted the docs/i18n branch October 25, 2026 18:47
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