[PR #1806] [MERGED] Localization: item names, container titles and server text follow the language #3775

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

📋 Pull Request Information

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

Base: main ← Head: fix/localized-ui-text


📝 Commits (4)

  • b457f63 Localization: names, container titles, death text and search follow the language
  • df23e1b Keep vanilla's death screen message; resolve with the loaded language
  • b9d2d93 Merge remote-tracking branch 'origin/main' into cg14/pr1806
  • bdbc816 Creative search: match the localized hover name, not the item's base name

📊 Changes

19 files changed (+217 additions, -74 deletions)

View changed files

📝 crates/horizon-client/src/creative.rs (+90 -2)
📝 crates/horizon-client/src/game.rs (+38 -19)
📝 crates/horizon-client/src/game/commands.rs (+1 -1)
📝 crates/horizon-client/src/game/machines.rs (+31 -19)
📝 crates/horizon-client/src/game/machines/crafter.rs (+2 -1)
📝 crates/horizon-client/src/game/mount_menu.rs (+2 -1)
📝 crates/horizon-client/src/game/options.rs (+1 -0)
📝 crates/horizon-client/src/game/packs.rs (+1 -0)
📝 crates/horizon-client/src/game/potions.rs (+1 -1)
📝 crates/horizon-client/src/game/recipe_book.rs (+1 -1)
📝 crates/horizon-client/src/game/remote.rs (+9 -0)
📝 crates/horizon-client/src/game/sign_edit.rs (+6 -5)
📝 crates/horizon-client/src/game/stations.rs (+15 -18)
📝 crates/horizon-client/src/game/storage.rs (+4 -2)
📝 crates/horizon-client/src/game/titles.rs (+1 -1)
📝 crates/horizon-client/src/game/tweaks.rs (+1 -1)
📝 crates/horizon-client/src/lang.rs (+5 -0)
📝 crates/horizon-client/src/menu.rs (+1 -1)
📝 crates/horizon-client/src/net.rs (+7 -1)

📄 Description

🤖 Opened by Excurs1ons's AI agent (OpenCode), not by Excurs1ons himself.

Fixes #1774 (the container, item/held name, creative tab, server-text and misc-message parts; the title screen is #1673 and Horizon's own captions #1682, both merged).

With lang:zh_cn several strings stayed English because the UI read the pinned English map or en_us directly. This makes them follow the language screen:

  • Item and block names: creative::Names gains display_item / display_get, which read the current language first and fall back to the pinned English name. Tooltips (name, potion, trim, container contents), the held-item label, anvil hovers, command feedback and creative-tab titles/tooltips use them. The pinned map stays for logic: the anvil comparison, the creative search index and the sort rank.
  • Station titles: Game::translate goes through lang::get_or instead of Enchantments' English table.
  • Container screens: chest/barrel/ender chest/shulker/hopper/dispenser/dropper/furnace/blast furnace/smoker/crafter/mount titles and their Inventory labels (the furnace fallback and the ridden entity's name included).
  • Server-resolved components: net::load_language loads the selected language over en_us (ClientLanguage.loadFrom), and the session's language follows a change in the language screen or a resource reload. Chest-like titles, death messages and command-suggestion tooltips stop resolving against English.
  • Death messages: always sent to the death screen as a translatable component (death.attack.generic, death.attack.outOfWorld), even with showDeathMessages off; the chat broadcast still obeys the gamerule.
  • Creative search: matches the localized display name as well as the English tooltip lines and id, so typing 铁砧 finds the anvil.
  • Sign editors: sign.edit / hanging_sign.edit.

The anvil's name box and its comparison are untouched, as the issue asks.

Verification

  • cargo fmt --check clean; cargo build --profile fast -p horizon-client builds (one pre-existing unused-variable warning in game.rs:7541 from main).
  • cargo test -p horizon-client --lib: 1072 passed, 3 fail for local environment reasons (save::tests::session_lock_is_exclusive: Windows file lock; packs::cache::tests::directory_inputs_config_and_owned_output_recovery: PermissionDenied; crash::tests::stacks_start_at_the_panicking_frame: backtrace path).
  • New tests: creative_tab_titles_have_vanilla_keys, search_matches_the_display_name_in_the_selected_language.
  • Played with lang:zh_cn on the default server-thread path: item names/tooltips/held name, creative tabs and their hover names, furnace/smoker/blast furnace/sign/chest/hopper/crafter screens, the effects panel, recipe-book search, the death screen and server chat.

pr_ready

pr_ready (tools/pr_ready.py --quick, 3 min 8 s)

Check Result
Scope ⚠️ 36 files, +832 −102; 934 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (5 s)
clippy ❌ failed (20 s)
tests: horizon-client ❌ 1072 passed, 3 failed (2 min 38 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The scope line counts untracked local files (.idea/, ctl.log, shaderpacks/); the commit itself is 20 files, +235 −102 (337 lines). The clippy failure is the pre-existing boxed_local in streaming.rs:641 (and horizon-world's manual_range_contains when dependencies are linted), plus the unused save_root in game.rs from main. The three failing tests (save::session_lock_is_exclusive, packs::cache::…owned_output_recovery, crash::…panicking_frame) fail the same way on a clean tree with this Windows toolchain.

Overlap with open PRs

  • #1741 (feat/styled-menu-titles) rewrites the menu-title path to keep Text styles, which incidentally localizes server titles too. This PR fixes the language source for the current path, plus the in-frame fallbacks and the death/suggestion components. Whichever lands first, the other rebases; they are not the same fix.
  • #1702 (fix/styled-server-item-names) touches some of the same name call sites for styled server names; this PR only picks the localized text.

🤖 Generated with OpenCode (DeepSeek V4.1 Flash)


🔄 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/1806 **Author:** [@Excurs1ons](https://github.com/Excurs1ons) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/localized-ui-text` --- ### 📝 Commits (4) - [`b457f63`](https://github.com/horizon-rust/horizon/commit/b457f6382a76b2bfa64077fee92a5bbaa9feca61) Localization: names, container titles, death text and search follow the language - [`df23e1b`](https://github.com/horizon-rust/horizon/commit/df23e1bfed0c2fde5d9c319ccae18fed3c6b036b) Keep vanilla's death screen message; resolve with the loaded language - [`b9d2d93`](https://github.com/horizon-rust/horizon/commit/b9d2d93ccbfd946b2597338fccd319153213acb7) Merge remote-tracking branch 'origin/main' into cg14/pr1806 - [`bdbc816`](https://github.com/horizon-rust/horizon/commit/bdbc816486ea2bc8aa3362a8547be73af897a9a1) Creative search: match the localized hover name, not the item's base name ### 📊 Changes **19 files changed** (+217 additions, -74 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/creative.rs` (+90 -2) 📝 `crates/horizon-client/src/game.rs` (+38 -19) 📝 `crates/horizon-client/src/game/commands.rs` (+1 -1) 📝 `crates/horizon-client/src/game/machines.rs` (+31 -19) 📝 `crates/horizon-client/src/game/machines/crafter.rs` (+2 -1) 📝 `crates/horizon-client/src/game/mount_menu.rs` (+2 -1) 📝 `crates/horizon-client/src/game/options.rs` (+1 -0) 📝 `crates/horizon-client/src/game/packs.rs` (+1 -0) 📝 `crates/horizon-client/src/game/potions.rs` (+1 -1) 📝 `crates/horizon-client/src/game/recipe_book.rs` (+1 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+9 -0) 📝 `crates/horizon-client/src/game/sign_edit.rs` (+6 -5) 📝 `crates/horizon-client/src/game/stations.rs` (+15 -18) 📝 `crates/horizon-client/src/game/storage.rs` (+4 -2) 📝 `crates/horizon-client/src/game/titles.rs` (+1 -1) 📝 `crates/horizon-client/src/game/tweaks.rs` (+1 -1) 📝 `crates/horizon-client/src/lang.rs` (+5 -0) 📝 `crates/horizon-client/src/menu.rs` (+1 -1) 📝 `crates/horizon-client/src/net.rs` (+7 -1) </details> ### 📄 Description > 🤖 Opened by Excurs1ons's AI agent (OpenCode), not by Excurs1ons himself. Fixes #1774 (the container, item/held name, creative tab, server-text and misc-message parts; the title screen is #1673 and Horizon's own captions #1682, both merged). With `lang:zh_cn` several strings stayed English because the UI read the pinned English map or `en_us` directly. This makes them follow the language screen: - **Item and block names**: `creative::Names` gains `display_item` / `display_get`, which read the current language first and fall back to the pinned English name. Tooltips (name, potion, trim, container contents), the held-item label, anvil hovers, command feedback and creative-tab titles/tooltips use them. The pinned map stays for logic: the anvil comparison, the creative search index and the sort rank. - **Station titles**: `Game::translate` goes through `lang::get_or` instead of `Enchantments`' English table. - **Container screens**: chest/barrel/ender chest/shulker/hopper/dispenser/dropper/furnace/blast furnace/smoker/crafter/mount titles and their `Inventory` labels (the furnace fallback and the ridden entity's name included). - **Server-resolved components**: `net::load_language` loads the selected language over `en_us` (`ClientLanguage.loadFrom`), and the session's language follows a change in the language screen or a resource reload. Chest-like titles, death messages and command-suggestion tooltips stop resolving against English. - **Death messages**: always sent to the death screen as a translatable component (`death.attack.generic`, `death.attack.outOfWorld`), even with `showDeathMessages` off; the chat broadcast still obeys the gamerule. - **Creative search**: matches the localized display name as well as the English tooltip lines and id, so typing `铁砧` finds the anvil. - **Sign editors**: `sign.edit` / `hanging_sign.edit`. The anvil's name box and its comparison are untouched, as the issue asks. ## Verification - `cargo fmt --check` clean; `cargo build --profile fast -p horizon-client` builds (one pre-existing unused-variable warning in `game.rs:7541` from main). - `cargo test -p horizon-client --lib`: 1072 passed, 3 fail for local environment reasons (`save::tests::session_lock_is_exclusive`: Windows file lock; `packs::cache::tests::directory_inputs_config_and_owned_output_recovery`: PermissionDenied; `crash::tests::stacks_start_at_the_panicking_frame`: backtrace path). - New tests: `creative_tab_titles_have_vanilla_keys`, `search_matches_the_display_name_in_the_selected_language`. - Played with `lang:zh_cn` on the default server-thread path: item names/tooltips/held name, creative tabs and their hover names, furnace/smoker/blast furnace/sign/chest/hopper/crafter screens, the effects panel, recipe-book search, the death screen and server chat. ## pr_ready **pr_ready** (`tools/pr_ready.py --quick`, 3 min 8 s) | Check | Result | | --- | --- | | Scope | ⚠️ 36 files, +832 −102; 934 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (5 s) | | clippy | ❌ failed (20 s) | | tests: horizon-client | ❌ 1072 passed, 3 failed (2 min 38 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The scope line counts untracked local files (`.idea/`, `ctl.log`, `shaderpacks/`); the commit itself is 20 files, +235 −102 (337 lines). The clippy failure is the pre-existing `boxed_local` in `streaming.rs:641` (and `horizon-world`'s `manual_range_contains` when dependencies are linted), plus the unused `save_root` in `game.rs` from main. The three failing tests (`save::session_lock_is_exclusive`, `packs::cache::…owned_output_recovery`, `crash::…panicking_frame`) fail the same way on a clean tree with this Windows toolchain. ## Overlap with open PRs - #1741 (`feat/styled-menu-titles`) rewrites the menu-title path to keep `Text` styles, which incidentally localizes server titles too. This PR fixes the language source for the current path, plus the in-frame fallbacks and the death/suggestion components. Whichever lands first, the other rebases; they are not the same fix. - #1702 (`fix/styled-server-item-names`) touches some of the same name call sites for styled server names; this PR only picks the localized text. 🤖 Generated with OpenCode (DeepSeek V4.1 Flash) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:14 +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#3775
No description provided.