[PR #1926] [MERGED] Enchantments: the name and the level follow the selected language #3869

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

📋 Pull Request Information

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

Base: main ← Head: fix/enchantment-names-language


📝 Commits (2)

  • 3762ab7 Enchantments: the name and the level follow the selected language
  • b7629cf Enchantments: say which callers have no language

📊 Changes

1 file changed (+50 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/enchant.rs (+50 -5)

📄 Description

🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself.

Refs #1774. This is the enchantment-name half of the report; the item-name half is #1806 and this branch does not touch it.

Enchantments::load resolves every enchantment's description from assets/minecraft/lang/en_us.json at load, and full_name reads enchantment.level.<n> from the same pinned table. The registry therefore holds English names for the whole run whatever language the player picks, which is why a tooltip shows "Алмазный меч" with "Sharpness III" under it.

Three changes, all in enchant.rs:

  • Enchantment.description_key keeps the JSON's description.translate value beside the English text, which stays as the fallback.
  • full_name resolves that key, and then enchantment.level.<n>, through the current language the same way Enchantments::translate already serves the attribute lines. A language with no entry for the key falls back to the English name resolved at load, which is all the server thread, the probes and an old resource root have, since none of them sets a language.
  • full_name_in(Some(&language), ..) is the seam the test uses, so the assertions do not depend on the process-wide language that other tests run beside.

Vanilla's shape: Enchantment.getFullname is the description component, a space, then enchantment.level.<n>.

How tested:

  • cargo clippy -p horizon-client --all-targets -- -D warnings
  • enchant::tests::names_follow_the_language: with a ru_ru source carrying enchantment.minecraft.sharpness = "Острота" and enchantment.level.5 = "V", full_name_in gives "Острота V", and an enchantment whose key that language lacks keeps the English name it was loaded with.
  • In the running client built from this branch (cargo build --profile fast -p horizon-client), lang:ru_ru in options.txt, prepared resources from the installed v0.2.58:
/enchant @s minecraft:sharpness 3   -> Наложены чары «Острота III» на предмет ...
/enchant @s minecraft:unbreaking 2  -> Наложены чары «Прочность II» на предмет ...

Those replies come from game/commands/effects.rs, which asks the same full_name the tooltip does.

Not observed: the inventory tooltip itself, because the control socket has no way to hover a slot. The tooltip path reaches the same full_name through Enchantments::tooltip.

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

The pr_ready block follows as a comment.


🔄 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/1926 **Author:** [@Domanffe](https://github.com/Domanffe) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/enchantment-names-language` --- ### 📝 Commits (2) - [`3762ab7`](https://github.com/horizon-rust/horizon/commit/3762ab7cdaa0f67c8cd473a88347098ebc982f92) Enchantments: the name and the level follow the selected language - [`b7629cf`](https://github.com/horizon-rust/horizon/commit/b7629cf6560ac31557d751638910acdc8bf7e0f8) Enchantments: say which callers have no language ### 📊 Changes **1 file changed** (+50 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/enchant.rs` (+50 -5) </details> ### 📄 Description > 🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself. Refs #1774. This is the enchantment-name half of the report; the item-name half is #1806 and this branch does not touch it. `Enchantments::load` resolves every enchantment's `description` from `assets/minecraft/lang/en_us.json` at load, and `full_name` reads `enchantment.level.<n>` from the same pinned table. The registry therefore holds English names for the whole run whatever language the player picks, which is why a tooltip shows "Алмазный меч" with "Sharpness III" under it. Three changes, all in `enchant.rs`: - `Enchantment.description_key` keeps the JSON's `description.translate` value beside the English text, which stays as the fallback. - `full_name` resolves that key, and then `enchantment.level.<n>`, through the current language the same way `Enchantments::translate` already serves the attribute lines. A language with no entry for the key falls back to the English name resolved at load, which is all the server thread, the probes and an old resource root have, since none of them sets a language. - `full_name_in(Some(&language), ..)` is the seam the test uses, so the assertions do not depend on the process-wide language that other tests run beside. Vanilla's shape: `Enchantment.getFullname` is the `description` component, a space, then `enchantment.level.<n>`. How tested: - `cargo clippy -p horizon-client --all-targets -- -D warnings` - `enchant::tests::names_follow_the_language`: with a `ru_ru` source carrying `enchantment.minecraft.sharpness` = "Острота" and `enchantment.level.5` = "V", `full_name_in` gives "Острота V", and an enchantment whose key that language lacks keeps the English name it was loaded with. - In the running client built from this branch (`cargo build --profile fast -p horizon-client`), `lang:ru_ru` in `options.txt`, prepared resources from the installed v0.2.58: ``` /enchant @s minecraft:sharpness 3 -> Наложены чары «Острота III» на предмет ... /enchant @s minecraft:unbreaking 2 -> Наложены чары «Прочность II» на предмет ... ``` Those replies come from `game/commands/effects.rs`, which asks the same `full_name` the tooltip does. Not observed: the inventory tooltip itself, because the control socket has no way to hover a slot. The tooltip path reaches the same `full_name` through `Enchantments::tooltip`. Still English after this and after #1806: the attribute and modifier lines (`attribute.*`, `item.modifiers.*`, `effect.*`), which #1806 routes through the language in `Game::translate`. The `pr_ready` block follows as a comment. --- <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:53 +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#3869
No description provided.