[PR #1682] [MERGED] Options: Horizon's own captions read a bundled language namespace #3687

Closed
opened 2026-11-03 04:11:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1682
Author: @Domanffe
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @ludovic111

Base: main ← Head: feat/horizon-lang-namespace


📝 Commits (2)

  • e30166f Options: Horizon's own captions read a bundled language namespace (#1672)
  • f28722f Lang: drop horizon.menu.friends, vanilla has gui.friends.open

📊 Changes

4 files changed (+76 additions, -14 deletions)

View changed files

➕ crates/horizon-client/assets/horizon/lang/en_us.json (+15 -0)
➕ crates/horizon-client/assets/horizon/lang/ru_ru.json (+15 -0)
📝 crates/horizon-client/src/lang.rs (+31 -0)
📝 crates/horizon-client/src/options_ui.rs (+15 -14)

📄 Description

🤖 Agent

Horizon's own settings had English captions because they are not vanilla options and have no vanilla key to borrow. This gives them a namespace the client carries itself.

The client now bundles assets/horizon/lang/en_us.json and ru_ru.json and feeds them to the language as one more ResourceSource (Bundled in lang.rs), placed first so a resource pack or the prepared root can still override any of these strings. Nothing else about the loader changes: it already walks assets/<namespace>/lang/<code>.json for every namespace a source reports.

Thirteen captions move from literals to keys: controller enable, vibration, adaptive triggers, lightbar, look sensitivity, invert X and Y, sneak button, move dead zone, look dead zone, button glyphs, menu navigation, on screen keyboard. They read through the same tr(caption) path as the vanilla options, and tooltip_key builds <key>.tooltip, which the settings screen already skips when the language has no entry (key.filter(|key| lang::has(key)) at the tooltip site), so a missing tooltip shows nothing rather than a raw key. The Russian file carries a translation for each.

horizon.menu.friends is in both files as well, for the title screen's Friends tooltip in #1673; it is unused on this branch and harmless.

Test: bundled_horizon_strings_follow_the_language loads a language with an empty resource source, which is the "no resources at all" case, and asserts the English caption and its Russian translation both resolve. Full cargo test -p horizon-client --lib is 1063 passed, and the three failures are the pre-existing Windows ones (save session lock, packs cache, crash frames).

Not done here: the multiplayer screen. Most of its labels are vanilla screens and should read selectServer.*, addServer.* and manageServer.* rather than new strings, which is a separate change with its own risk of wrong keys; #1672 tracks it.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1682 **Author:** [@Domanffe](https://github.com/Domanffe) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/horizon-lang-namespace` --- ### 📝 Commits (2) - [`e30166f`](https://github.com/horizon-rust/horizon/commit/e30166f23bad89819e505fa1b2abd865cdafd63b) Options: Horizon's own captions read a bundled language namespace (#1672) - [`f28722f`](https://github.com/horizon-rust/horizon/commit/f28722fb15d8a65f2b2c2c64e6d2c9305e64f1ae) Lang: drop horizon.menu.friends, vanilla has gui.friends.open ### 📊 Changes **4 files changed** (+76 additions, -14 deletions) <details> <summary>View changed files</summary> ➕ `crates/horizon-client/assets/horizon/lang/en_us.json` (+15 -0) ➕ `crates/horizon-client/assets/horizon/lang/ru_ru.json` (+15 -0) 📝 `crates/horizon-client/src/lang.rs` (+31 -0) 📝 `crates/horizon-client/src/options_ui.rs` (+15 -14) </details> ### 📄 Description 🤖 Agent Horizon's own settings had English captions because they are not vanilla options and have no vanilla key to borrow. This gives them a namespace the client carries itself. The client now bundles `assets/horizon/lang/en_us.json` and `ru_ru.json` and feeds them to the language as one more `ResourceSource` (`Bundled` in `lang.rs`), placed first so a resource pack or the prepared root can still override any of these strings. Nothing else about the loader changes: it already walks `assets/<namespace>/lang/<code>.json` for every namespace a source reports. Thirteen captions move from literals to keys: controller enable, vibration, adaptive triggers, lightbar, look sensitivity, invert X and Y, sneak button, move dead zone, look dead zone, button glyphs, menu navigation, on screen keyboard. They read through the same `tr(caption)` path as the vanilla options, and `tooltip_key` builds `<key>.tooltip`, which the settings screen already skips when the language has no entry (`key.filter(|key| lang::has(key))` at the tooltip site), so a missing tooltip shows nothing rather than a raw key. The Russian file carries a translation for each. `horizon.menu.friends` is in both files as well, for the title screen's Friends tooltip in #1673; it is unused on this branch and harmless. Test: `bundled_horizon_strings_follow_the_language` loads a language with an empty resource source, which is the "no resources at all" case, and asserts the English caption and its Russian translation both resolve. Full `cargo test -p horizon-client --lib` is 1063 passed, and the three failures are the pre-existing Windows ones (`save` session lock, `packs` cache, `crash` frames). Not done here: the multiplayer screen. Most of its labels are vanilla screens and should read `selectServer.*`, `addServer.*` and `manageServer.*` rather than new strings, which is a separate change with its own risk of wrong keys; #1672 tracks it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:11:25 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3687
No description provided.