feat(theme): multilingual theme — i18n, language switch, hreflang, render-time links #196
No reviewers
Labels
No labels
bug
enhancement
needs-triage
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/deckle!196
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/191"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #191
What
The deckle theme and the news/categories bundles now render every configured language correctly from the translation files #190 introduced.
l10n/source.html,l10n/here.html,l10n/pages.html) drive backend layouts, menus (weight,hidden,hideChildren), the footer (footer), child teasers,page-teasers, the news list and element, and the category pages.partials/pagetypes/<type>.htmland category entries topartials/category-entry/<type>.html;index.htmland_default/{list,single}.htmldispatch on the source page's type.ce/href.htmllooks a stored value up by content path. It returns the current-language translation, else the default-language page, else a bundle file, else the value as stored. The fragment and query are kept. External,mailto:,tel:and/media/…values are emitted as stored._default/_markup/render-link.htmlapplies the same rule to markdown links. A test checks it renders byte-for-byte like goldmark's own link rendering.<a>form is resolved by a post-pass inbackendlayout/render.html, because render hooks never see raw HTML.l10n/t.html. This includes the skip link, nav labels, 404, pager, lightbox and consent labels, video and contact-form defaults, "All news →", RSS text and the date format.themes/deckle/i18n/{en,de}.tomlandfeatures/news/i18n/news/{en,de}.toml.l10n/t.htmlwrapsT. When a key is missing it falls back to the English string, so a site whose default language has no i18n file (e.g.harness init --lang fr) still shows its labels.time.Format, so German shows "5. Januar 2026"..Language.Label, the current one markedaria-current="page", no JS. It is not rendered on a single-language site or on a page without translations.x-default, on multilingual sites only.hugo.tomlcomments: per-languagetitleand[languages.<code>.params]are documented, and the stale "old address kept as an alias" claim is fixed (#194).Verification
Fixture sites. I built a fixture with the pinned Hugo 0.167.0 and
--minify: a one-language site (news, categories, the showcase page, a links table) and the same site afterharness lang add dewith German translations, usingslug: diensteon Services.main. Every HTML page and JS file is byte-identical except two expected changes:css/theme.cssgains the.site-langrules.tel:button link that used to render as#ZgotmplZ(html/template blanked it) now renders astel:+43./en/, e.g./services/→/en/services/. The old values were dead links, since no aliases exist;tel:fix.two-col, with hidden pages absent from the German menu;/services/web/resolved to/de/dienste/web/, and an untranslated target resolved to/en/…;New integration tests in
internal/theme:l10n_fields_test.go: the translation file carries nobackendLayout,weightorhidden, yet the page renders with them; plus menus, footer, news, categories and drafts.links_test.go: the resolution table, the goldmark byte-identity corpus, and single-language output staying unchanged.i18n_test.go: German strings and dates, the switch and hreflang rules, a fr-default site withoutfr.toml, and a missing key falling back.Checks:
go test ./..., including the skills and AGENTS.md drift tests, with hugo on PATH.go vet ./...andgofmt -lare clean.harness checkreports 0 errors on the fixture site.Known limits (documented)
outputsfrom the translation file.harness add newsonly fills gaps, so the old v4 templates stay. AGENTS.md describes deleting the unmodified vendored files and re-adding.l10n/partials.🤖 Generated with Claude Code
[autoland] verdict: pass
PASS — CI aggregate success (ci / build-and-test: npm build+test, go vet, go test ./... with pinned Hugo 0.167.0) on head
f6cc287. Conventional title, Closes #191, base contained (no conflict). Diff matches #191: ce/href.html + render-link hook + new-tab post-pass, l10n/{source,here,pages} for source-page fields and strict menus/lists, i18n via l10n/t.html (en/de, English fallback), header switch, hreflang/x-default, hugo.toml per-language params comment. AGENTS.md, theme README and the affected skills updated per CLAUDE.md; drift tests pass. Also re-ran locally: go vet + go test ./... with Hugo 0.167.0 (theme integration tests not skipped) — all green.