[GH-ISSUE #1774] Localization: with zh_cn selected, the main menu, item names, container titles, creative tabs and server text stay English #541

Closed
opened 2026-11-02 15:39:53 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @kohad1ck on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1774

Environment

  • Horizon client v0.2.53 (Minecraft Java Edition 26.3), Windows
  • Language selected as 简体中文 (Simplified Chinese) in Options → Language
  • options.txt contains lang:zh_cn
  • No resource packs

What happens

With zh_cn selected, the language screen itself is Chinese, but large parts of the UI stay English:

  1. Title screen — Singleplayer, Multiplayer, Minecraft Realms, Options..., Quit Game; the Select World screen also shows Select World, Play Selected World, Create New World, Back.
  2. Container screens — furnace / blast furnace / smoker, hopper / dispenser / dropper titles, and the Inventory / Crafting labels.
  3. Item names — item tooltips and the held-item name show English names (for example Red Sand instead of 红沙). Enchantment names, attribute lines and potion effect lines are English too.
  4. Creative inventory — tab titles are the exported English names (Building Blocks, Combat, Ingredients, ...).
  5. Server-provided text — chat, death messages, boss bars, tab list entries and command suggestion tooltips are resolved against en_us.
  6. Other messages — bed/sleep messages, Respawn point set, Saved the game, Destroy Item.

Root causes found in the source

  • Game::translate in crates/horizon-client/src/game/stations.rs reads Enchantments.lang, which is loaded from assets/minecraft/lang/en_us.json in enchant.rs and filtered to a few key prefixes. It never follows the process-wide selected language, so every container/station label that goes through it stays English.
  • crate::creative::Names::item (used for item display names, tooltips and the held-item name) only reads the pinned English map.
  • Enchantments::full_name precomputes the enchantment description from the English map.
  • net::load_language always loads en_us.json, so server translatable components are resolved to English.
  • The title screen main/Select World buttons are hardcoded English in title.rs.
  • Creative tab titles are drawn from the English title field of creative-inventory.json instead of itemGroup.*.
  • Several container titles/labels are hardcoded English.

Proposed fix

  • Make Game::translate use the current language (lang::get_or) instead of Enchantments.lang.
  • Add a display-only item-name lookup that prefers the current language and falls back to the pinned English map, and use it for tooltips, the held-item name and command feedback. Keep the canonical English name for logic and search.
  • Store the enchantment description key and translate it at display time; translate level names too.
  • Load the selected language over en_us in net::load_language, and refresh that map when the language changes.
  • Use menu.*, selectWorld.* and gui.back keys for the title-screen buttons.
  • Map creative tab ids to itemGroup.* keys.
  • Localize container titles/labels (container.*, entity.minecraft.*) and the remaining messages.

Anvil caveat

Do not localize the anvil name box or change its comparison logic. Replacing the anvil's default-name comparison with a localized display name (and pre-selecting the box) regressed rename/take behavior. That change has been reverted; the anvil name box keeps the original behavior and may stay English for now.

Verification

  • cargo check -p horizon-client passes.
  • Screenshots with zh_cn: title screen, Select World, creative tabs, crafting table and item tooltips are Chinese.
  • Anvil rename/input are back to the original behavior; a menu-engine regression test covers result-name preservation.
Originally created by @kohad1ck on GitHub (Oct 25, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1774 ## Environment - Horizon client v0.2.53 (Minecraft Java Edition 26.3), Windows - Language selected as 简体中文 (Simplified Chinese) in Options → Language - `options.txt` contains `lang:zh_cn` - No resource packs ## What happens With `zh_cn` selected, the language screen itself is Chinese, but large parts of the UI stay English: 1. **Title screen** — `Singleplayer`, `Multiplayer`, `Minecraft Realms`, `Options...`, `Quit Game`; the Select World screen also shows `Select World`, `Play Selected World`, `Create New World`, `Back`. 2. **Container screens** — furnace / blast furnace / smoker, hopper / dispenser / dropper titles, and the `Inventory` / `Crafting` labels. 3. **Item names** — item tooltips and the held-item name show English names (for example `Red Sand` instead of 红沙). Enchantment names, attribute lines and potion effect lines are English too. 4. **Creative inventory** — tab titles are the exported English names (`Building Blocks`, `Combat`, `Ingredients`, ...). 5. **Server-provided text** — chat, death messages, boss bars, tab list entries and command suggestion tooltips are resolved against `en_us`. 6. **Other messages** — bed/sleep messages, `Respawn point set`, `Saved the game`, `Destroy Item`. ## Root causes found in the source - `Game::translate` in `crates/horizon-client/src/game/stations.rs` reads `Enchantments.lang`, which is loaded from `assets/minecraft/lang/en_us.json` in `enchant.rs` and filtered to a few key prefixes. It never follows the process-wide selected language, so every container/station label that goes through it stays English. - `crate::creative::Names::item` (used for item display names, tooltips and the held-item name) only reads the pinned English map. - `Enchantments::full_name` precomputes the enchantment `description` from the English map. - `net::load_language` always loads `en_us.json`, so server translatable components are resolved to English. - The title screen main/Select World buttons are hardcoded English in `title.rs`. - Creative tab titles are drawn from the English `title` field of `creative-inventory.json` instead of `itemGroup.*`. - Several container titles/labels are hardcoded English. ## Proposed fix - Make `Game::translate` use the current language (`lang::get_or`) instead of `Enchantments.lang`. - Add a display-only item-name lookup that prefers the current language and falls back to the pinned English map, and use it for tooltips, the held-item name and command feedback. Keep the canonical English name for logic and search. - Store the enchantment description key and translate it at display time; translate level names too. - Load the selected language over `en_us` in `net::load_language`, and refresh that map when the language changes. - Use `menu.*`, `selectWorld.*` and `gui.back` keys for the title-screen buttons. - Map creative tab ids to `itemGroup.*` keys. - Localize container titles/labels (`container.*`, `entity.minecraft.*`) and the remaining messages. ### Anvil caveat Do **not** localize the anvil name box or change its comparison logic. Replacing the anvil's default-name comparison with a localized display name (and pre-selecting the box) regressed rename/take behavior. That change has been reverted; the anvil name box keeps the original behavior and may stay English for now. ## Verification - `cargo check -p horizon-client` passes. - Screenshots with `zh_cn`: title screen, Select World, creative tabs, crafting table and item tooltips are Chinese. - Anvil rename/input are back to the original behavior; a menu-engine regression test covers result-name preservation.
Author
Owner

@Excurs1ons commented on GitHub (Oct 25, 2026):

🤖 Agent: Claiming this for Excurs1ons with OpenCode.

Scope: items 2-6 of the report (container titles, item/held names, creative tab titles, server-resolved text, the misc messages). Item 1 (title screen) is already #1673 and Horizon's own captions are #1682, so I am not touching title.rs, options_ui.rs or lang.rs.

Plan, one small PR each:

  1. display-only item names (tooltips, held item, command feedback) that prefer the current language and keep the English map for logic and search;
  2. Game::translate through lang::get_or instead of Enchantments.lang;
  3. creative tab titles from itemGroup.*;
  4. reproduce the server-text half before changing net::load_language — #1389 was closed as fixed for the SystemChat path, so I want evidence first.

I will not localize the anvil name box, per the caveat in the report. Reproducing on 26.3 with lang:zh_cn now.

<!-- gh-comment-id:6397599482 --> @Excurs1ons commented on GitHub (Oct 25, 2026): 🤖 Agent: Claiming this for Excurs1ons with OpenCode. Scope: items 2-6 of the report (container titles, item/held names, creative tab titles, server-resolved text, the misc messages). Item 1 (title screen) is already #1673 and Horizon's own captions are #1682, so I am not touching `title.rs`, `options_ui.rs` or `lang.rs`. Plan, one small PR each: 1. display-only item names (tooltips, held item, command feedback) that prefer the current language and keep the English map for logic and search; 2. `Game::translate` through `lang::get_or` instead of `Enchantments.lang`; 3. creative tab titles from `itemGroup.*`; 4. reproduce the server-text half before changing `net::load_language` — #1389 was closed as fixed for the SystemChat path, so I want evidence first. I will not localize the anvil name box, per the caveat in the report. Reproducing on 26.3 with `lang:zh_cn` now.
Author
Owner

@Excurs1ons commented on GitHub (Oct 25, 2026):

🤖 Agent: Opened #1806 for the container, item/held name, creative tab, server-text and misc-message parts of this report. The title screen (#1673) and Horizon's own option captions (#1682) were already merged, so this leaves those alone.

<!-- gh-comment-id:6398479283 --> @Excurs1ons commented on GitHub (Oct 25, 2026): 🤖 Agent: Opened #1806 for the container, item/held name, creative tab, server-text and misc-message parts of this report. The title screen (#1673) and Horizon's own option captions (#1682) were already merged, so this leaves those alone.
Author
Owner

@ludovic111 commented on GitHub (Oct 25, 2026):

Claimed by Excursions on Discord, to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #1774).

<!-- gh-comment-id:6400324563 --> @ludovic111 commented on GitHub (Oct 25, 2026): Claimed by `Excursions` on Discord, to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #1774). <!-- kira:work -->
Author
Owner

@Domanffe commented on GitHub (Oct 25, 2026):

🤖 Agent: claimed the enchantment-name half in #1926.

Enchantments::load resolved every description from the pinned en_us map at load, and full_name read enchantment.level.<n> from the same table, so an enchantment line stayed English whatever the language screen said. #1926 keeps the description key on the registry entry and resolves it, and the level, through the current language at display time, with the English text as the fallback for the server thread, the probes and an old resource root.

Measured on a build from that branch, lang:ru_ru, prepared resources from the installed v0.2.58: /enchant @s minecraft:sharpness 3 answers Наложены чары «Острота III» ..., and /enchant @s minecraft:unbreaking 2 answers Наложены чары «Прочность II» .... Those replies come from the same full_name the tooltip calls. The inventory tooltip itself I did not observe, because the control socket cannot hover a slot.

Still English after #1806 and #1926: the attribute and modifier lines (attribute.*, item.modifiers.*, effect.*), which #1806 routes through the language in Game::translate.

<!-- gh-comment-id:6403216499 --> @Domanffe commented on GitHub (Oct 25, 2026): 🤖 Agent: claimed the enchantment-name half in #1926. `Enchantments::load` resolved every `description` from the pinned `en_us` map at load, and `full_name` read `enchantment.level.<n>` from the same table, so an enchantment line stayed English whatever the language screen said. #1926 keeps the description key on the registry entry and resolves it, and the level, through the current language at display time, with the English text as the fallback for the server thread, the probes and an old resource root. Measured on a build from that branch, `lang:ru_ru`, prepared resources from the installed v0.2.58: `/enchant @s minecraft:sharpness 3` answers `Наложены чары «Острота III» ...`, and `/enchant @s minecraft:unbreaking 2` answers `Наложены чары «Прочность II» ...`. Those replies come from the same `full_name` the tooltip calls. The inventory tooltip itself I did not observe, because the control socket cannot hover a slot. Still English after #1806 and #1926: the attribute and modifier lines (`attribute.*`, `item.modifiers.*`, `effect.*`), which #1806 routes through the language in `Game::translate`.
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#541
No description provided.