Help us shape the future of Go! Take the 2026 Go Developer Survey

i18ncheck

command
v0.44.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

i18ncheck reports where a translated Hugo content tree has drifted from the language it was translated from, in the four ways a translation must not change a page:

  • a page missing in a language, or present in one language only;

  • a fenced code block that is not byte-identical, in the same order: a transcript is what a program printed, and a translated transcript is one the program never printed;

  • a heading whose anchor differs: the translation keeps the source language's anchor as an explicit {#id}, so that every link into the page keeps its fragment in every language;

  • a relref target, or a weight, that differs: the same links, the same place in the sidebar.

    i18ncheck [-base en] <content-dir>

<content-dir> holds one directory per language (content/en, content/fr...). It exits 1 when it finds a difference, 2 on a usage error, 0 otherwise, and says how many pages and blocks it compared, because a check that compared nothing passes everything.

It was written after a night of translating go-authn's documentation into three languages with the same checks redone by hand -- an awk loop per run, one helper script per agent -- until three agents' helpers, sharing one name in one scratch directory, overwrote each other. A check that matters gets a home, a name nobody else uses, and tests.

Heading anchors are computed as Hugo's default (autoHeadingIDType "github") computes them: lower case, letters, digits, "-" and "_" kept, a space becoming "-", everything else dropped, and "-1", "-2"... for repeats on one page. Inline code and emphasis markers and link targets are removed first, as rendering would.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL