Repository navigation
Documentation in seven languages (fr, de, es, zh-Hans, ko, ja) - #48
Merged
Merged
Conversation
…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>
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.
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.languages:inhugo.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 ini18n/(Hextra'szh-cnstrings are copied tozh, 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).{#anchor}, so arelrefwith a fragment lands on the same heading in every language.layouts/baseof.htmlsetslangfrom the language's locale (zh-Hans), which Hextra's does not; CJK languages get font stacks that name the CJK system fonts aftersystem-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 ofcontent/enis missing in a language ofhugo.yamlor exists only in a translation; it warns when a translation changes code blocks, inline code, shortcodes, link targets or anchors (-strictfails on those too);-fixadds the anchors;-built publiccompares 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