mirror of
https://github.com/storytold/AniCraft.git
synced 2026-11-20 17:42:15 +01:00
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.
21 lines
1.0 KiB
PowerShell
21 lines
1.0 KiB
PowerShell
# Lists every AniCraft interface string for translators (ADR 0040, docs/localisation.md), as a
|
|
# craft-i18n catalog template. Same as scripts/i18n-extract.sh:
|
|
#
|
|
# scripts/i18n-extract.ps1 [out.tsv] # default: target/i18n/anicraft.tsv
|
|
# $env:CRAFT_I18N_DIR = 'C:\src\craft-i18n'; scripts/i18n-extract.ps1 # + coverage per locale
|
|
# $env:ANICRAFT_I18N_LOCALE = 'de'; scripts/i18n-extract.ps1 de.tsv # only what German lacks
|
|
param([string]$Out = '')
|
|
$ErrorActionPreference = 'Stop'
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
if ($Out -eq '') { $Out = Join-Path $root 'target/i18n/anicraft.tsv' }
|
|
elseif (-not [System.IO.Path]::IsPathRooted($Out)) { $Out = Join-Path (Get-Location) $Out }
|
|
Push-Location $root
|
|
try {
|
|
$env:ANICRAFT_I18N_OUT = $Out
|
|
cargo test --quiet --bin anicraft i18n::tests::extract -- --ignored --exact --nocapture
|
|
if ($LASTEXITCODE -ne 0) { throw "extraction failed ($LASTEXITCODE)" }
|
|
} finally {
|
|
Remove-Item Env:ANICRAFT_I18N_OUT -ErrorAction SilentlyContinue
|
|
Pop-Location
|
|
}
|