Add Spanish (Spain) UI localisation (es) #53

Manually merged
github merged 3 commits from github-bot/gh-53 into main 2026-12-05 19:00:51 +00:00 AGit
Owner

@⁠Kassadd on GitHub · 2026-12-05 16:38 UTC · original
Kassadd:locale/es → main · +303 −5 · 7 files · 3 commits · merged 2026-12-05 19:00 UTC

Adds locales/es.json (288 keys, the same key set and {0}-style placeholders as en) and registers it, so it works in the F10 menu, --lang es, LARP_LANGUAGE=es and automatic OS detection.

Registration — every place the language list is hard-coded:

File Change
locales/es.json new catalog, {"tag":"es","name":"Español","aliases":["es-ES"]}
crates/larp-game/src/settings.rs c("es", 7.0) appended to the language setting's choices
crates/larp-hle/src/settings.rs LANG_TAGS: [&str; 8], "es" appended in the same order
crates/larp-core/src/i18n.rs CATALOGS.len() 7 → 8, es-ES / es_MX alias asserts
apps/larp/src/main.rs, docs/environment-variables.md, README.md --lang help, LARP_LANGUAGE row, 7 → 8 languages

Appending at the end rather than inserting keeps the number saved in settings.ini (language = 6) pointing at the same tag, so nobody's language changes on upgrade.

The panel clips a string that does not fit — it does not wrap it, and inside a row a span may run into the next one. overlay.rs stops a span at panel.columns; the menu puts the label at column 2, the value at VALUE_AT = 34 and the "when" at WHEN_AT = 60. So the budget is not one number per key but one per column the string starts at:

  • setting.*.label ≤ 31 columns (English's longest is 29, the other locales' is 26);
  • a value the menu builds as "<default> (<choice>)" ≤ 26 columns, i.e. the two parts together, not each on its own;
  • pool.* names ≤ 20 columns (hostmem.rs);
  • *.about ≤ 2 lines of 74; effect and status lines ≤ 75 (one span at column 1 of a 76-column panel);
  • perf.* labels share the panel's 30 columns with their value on the right.

Technical terms are deliberately left in English where translating them would be worse than the English word (shader, pipeline, frame, back buffer, upscaler, mip, LOD, cull, ray tracing, streaming, heap, present, hook, screen-space, tessellation).

How it was tested

  • Built with cargo xwin build --release --locked -p larp --target x86_64-pc-windows-msvc in rust:1.98.1 with the Windows SDK, and run on Linux under Proton (larp.exe run … --execute) with LARP_LANGUAGE=es.
  • Seen on screen at 3440x1440, settings menu and F9 panel: Ajustes, [Imagen] / Sin probar, 4/19 and 15/19, every row label, the about box, the effect line (Surte efecto en el próximo arranque (…)), the when-column (ahora, ahora, reinicia, próximo arranque) and the performance panel (1% low, 0,1% low, el más largo, heap libre, objetos de textura, graphics heap, copias del título, pipelines).
  • Three strings were changed after those runs, because the first version was cut or overlapped on screen:
    • menu.hints.browse was cut at F10 (83 columns at column 1) → 72 columns;
    • menu.default.dlss_or_fsr wrapped into the value column → DLSS si hay, and with menu.value.default = defecto the whole defecto (DLSS si hay) is 21 of the 26 columns available. It is the same row that overflows in en/de/fr/pl/tr (default (DLSS where the card has it, else FSR) is 46), but that is not this PR's to fix.
  • cargo test -p larp-core --lib i18n — 5/5, including catalog completeness, placeholder parity and sort order.
  • Script over es.json against en.json: identical key set, zero placeholder mismatches, sorted, and the width limits above hold for every key.

Not tested: the F10 menu at a resolution other than 3440x1440, and the CJK paths (no zh strings touched).

Note: #48 adds locales/pt-BR.json but does not touch the three registration points, so that catalog would not be reachable from the menu or --lang; the same three edits are needed there. Same for the missing setting.speaker_gain.* and setting.volumetrics_quality.* keys that the OCR review of #23 mentions — es.json mirrors en.json, so it inherits the gap rather than introducing it.

**@⁠Kassadd** on GitHub · 2026-12-05 16:38 UTC · [original](https://github.com/gamingwithhomie/larp/pull/53) `Kassadd:locale/es` → `main` · +303 −5 · 7 files · 3 commits · merged 2026-12-05 19:00 UTC Adds `locales/es.json` (288 keys, the same key set and `{0}`-style placeholders as `en`) and registers it, so it works in the `F10` menu, `--lang es`, `LARP_LANGUAGE=es` and automatic OS detection. **Registration — every place the language list is hard-coded:** | File | Change | |---|---| | `locales/es.json` | new catalog, `{"tag":"es","name":"Español","aliases":["es-ES"]}` | | `crates/larp-game/src/settings.rs` | `c("es", 7.0)` **appended** to the `language` setting's choices | | `crates/larp-hle/src/settings.rs` | `LANG_TAGS: [&str; 8]`, `"es"` appended in the same order | | `crates/larp-core/src/i18n.rs` | `CATALOGS.len()` 7 → 8, `es-ES` / `es_MX` alias asserts | | `apps/larp/src/main.rs`, `docs/environment-variables.md`, `README.md` | `--lang` help, `LARP_LANGUAGE` row, 7 → 8 languages | Appending at the end rather than inserting keeps the number saved in `settings.ini` (`language = 6`) pointing at the same tag, so nobody's language changes on upgrade. **The panel clips a string that does not fit — it does not wrap it**, and inside a row a span may run into the next one. `overlay.rs` stops a span at `panel.columns`; the menu puts the label at column 2, the value at `VALUE_AT = 34` and the "when" at `WHEN_AT = 60`. So the budget is not one number per key but one per column the string starts at: - `setting.*.label` ≤ 31 columns (English's longest is 29, the other locales' is 26); - a value the menu builds as `"<default> (<choice>)"` ≤ 26 columns, i.e. the two parts together, not each on its own; - `pool.*` names ≤ 20 columns (`hostmem.rs`); - `*.about` ≤ 2 lines of 74; effect and status lines ≤ 75 (one span at column 1 of a 76-column panel); - `perf.*` labels share the panel's 30 columns with their value on the right. Technical terms are deliberately left in English where translating them would be worse than the English word (shader, pipeline, frame, back buffer, upscaler, mip, LOD, cull, ray tracing, streaming, heap, present, hook, screen-space, tessellation). **How it was tested** - Built with `cargo xwin build --release --locked -p larp --target x86_64-pc-windows-msvc` in `rust:1.98.1` with the Windows SDK, and run on Linux under Proton (`larp.exe run … --execute`) with `LARP_LANGUAGE=es`. - **Seen on screen at 3440x1440**, settings menu and `F9` panel: `Ajustes`, `[Imagen]` / `Sin probar`, `4/19` and `15/19`, every row label, the about box, the effect line (`Surte efecto en el próximo arranque (…)`), the when-column (`ahora`, `ahora, reinicia`, `próximo arranque`) and the performance panel (`1% low`, `0,1% low`, `el más largo`, `heap libre`, `objetos de textura`, `graphics heap`, `copias del título`, `pipelines`). - Three strings were **changed after those runs**, because the first version was cut or overlapped on screen: - `menu.hints.browse` was cut at `F10` (83 columns at column 1) → 72 columns; - `menu.default.dlss_or_fsr` wrapped into the value column → `DLSS si hay`, and with `menu.value.default` = `defecto` the whole `defecto (DLSS si hay)` is 21 of the 26 columns available. It is the same row that overflows in en/de/fr/pl/tr (`default (DLSS where the card has it, else FSR)` is 46), but that is not this PR's to fix. - `cargo test -p larp-core --lib i18n` — 5/5, including catalog completeness, placeholder parity and sort order. - Script over `es.json` against `en.json`: identical key set, zero placeholder mismatches, sorted, and the width limits above hold for every key. Not tested: the `F10` menu at a resolution other than 3440x1440, and the CJK paths (no `zh` strings touched). Note: #48 adds `locales/pt-BR.json` but does not touch the three registration points, so that catalog would not be reachable from the menu or `--lang`; the same three edits are needed there. Same for the missing `setting.speaker_gain.*` and `setting.volumetrics_quality.*` keys that the OCR review of #23 mentions — `es.json` mirrors `en.json`, so it inherits the gap rather than introducing it.
New `locales/es.json` — 288 keys, same set and placeholders as `en`.
Registered like the other catalogs: appended to the `language` setting's
choices and to `LANG_TAGS`, so no existing `language =` value in
`settings.ini` changes meaning.

Technical terms stay in English (shader, pipeline, frame, back buffer,
upscaler, mip, LOD, cull, ray tracing, streaming, heap, present, hook);
strings are kept inside the panel's column limits — labels <= 31 columns
(the menu puts the value at 34), pool names <= 20 (`hostmem.rs`), about
text <= 2 lines of 74, effect/status lines <= 76.
Seen on screen: the hint line was cut at "F10", and the DLSS/FSR default
wrapped into the value column. Both are longer than any other locale's
(hints 72 columns at column 1, the default 32 before the value at 34).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 17:23:31 +00:00
github-bot force-pushed github-bot/gh-53 from 405244629a to 43d8100753 2026-12-05 17:30:38 +00:00 Compare
github manually merged commit 9c27708299 into main 2026-12-05 19:00:51 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.