Expand description
Checks a directory of catalogues (<dir>/<locale>/*.ftl): per
locale, coverage, missing and orphan keys, and keys whose English
changed since they were translated; across them, the faults that must
fail a build.
A key is one translatable unit: a message’s value (id) or one of its
attributes (id.attr).
Faults (a build fails): a file that does not parse, a key defined
twice in a locale, no English catalogue. Coverage, missing, orphan and
changed keys are a report: a translation lags behind English, and that
is normal. (Keys used by the code but absent in English are found by
the extractor, crate::extract.)
Changed English. Each translated locale keeps a sidecar,
<dir>/<locale>/english.hashes: one line per translated key, key hash, the hash of the English text the translation was made from. A
key whose English hash differs now is reported as changed; a
translated key with no recorded hash is reported as unstamped.
stamp records the hashes of newly translated keys, or of every one
once the changed translations were reviewed. A sidecar rather than
comments in the .ftl files, so translation tools that rewrite
comments cannot lose it.
Structs§
- Catalogs
- The catalogues of a directory: its
.ftlfiles and each locale’s hashes. - File
- One catalogue file.
- Locale
Report - One translated locale against English.
- Report
Enums§
- Fault
- What must fail a build.
Constants§
- HASHES
- The sidecar holding, per translated key, the hash of its English.
Functions§
- check
- Checks every locale against English.
- hash
- The hash recorded for an English text: 64-bit FNV-1a, in hex. Stable across Rust versions and platforms, unlike the standard hasher.
- stamp
- A locale’s sidecar brought up to date: the hash of the current English
for each translated key that has none (every translated key with
all), keys no longer translated or no longer in English dropped. - write_
hashes - The sidecar’s text for a locale.