Files
AniCraft/scripts/i18n-extract.sh
Tanish Manku cddd1ea2e0 feat(ui): interface languages: tr! everywhere in the shell, craft-i18n catalogs, pseudo-locale (M8)
A translation layer in the shell (src/i18n): English source text is the
key (tr!, trn! with CLDR plurals, trc!, tr_noop!), catalogs in the
craft-i18n TSV format read by our own parser and embedded from
CRAFT_I18N_DIR by build.rs, fallback app > shared > base > English.
Preferences > Appearance > Language (system language by default) and
--lang for one run. Every shell string and screen-reader name goes through
it; menus translate the registry's labels when drawn, ids stay English.

Guardrails: a source guideline test fails on prose literals outside the
macros, a pseudo-locale accessibility audit fails on untranslated names,
and scripts/i18n-extract.sh writes the translators' template (1173
strings) and per-locale coverage. Lookups: 13 ns from a catalog, 16 ns
pseudo, none in English.
2026-11-10 00:41:54 -07:00

22 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Lists every AniCraft interface string for translators (ADR 0040, docs/localisation.md), as a
# craft-i18n catalog template: the header, then one commented-out row per string
# (`#<context><TAB><English><TAB>`), for locales/<locale>/anicraft.tsv in storytold/craft-i18n.
# The strings come from the shell's tr!/trc!/trn!/tr_noop! calls and the command registry's
# labels and menus.
#
# scripts/i18n-extract.sh [out.tsv] # default: target/i18n/anicraft.tsv
# CRAFT_I18N_DIR=/abs/craft-i18n scripts/i18n-extract.sh # also: how much each locale covers
# CRAFT_I18N_DIR=/abs/craft-i18n ANICRAFT_I18N_LOCALE=de scripts/i18n-extract.sh de.tsv
# # only what German is missing
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
OUT="${1:-$ROOT/target/i18n/anicraft.tsv}"
case "$OUT" in
/* | [A-Za-z]:*) ;;
*) OUT="$PWD/$OUT" ;;
esac
ANICRAFT_I18N_OUT="$OUT" cargo test --quiet --bin anicraft i18n::tests::extract -- --ignored --exact --nocapture