[PR #3456] [MERGED] Tooltips: potion effect and armour trim lines in the selected language #4994

Closed
opened 2026-11-03 05:09:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3456
Author: @d3grando
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix-3312


📝 Commits (1)

  • 526887b Tooltips: potion effect and armour trim lines in the selected language

📊 Changes

2 files changed (+28 additions, -12 deletions)

View changed files

📝 crates/horizon-client-render/src/brewing.rs (+19 -0)
📝 crates/horizon-client/src/game/stations.rs (+9 -12)

📄 Description

🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves.

What and why

Part of #3312. The other part, the raw %2$s: %1$s attribute lines, is fixed by the open #3241. This PR doesn't touch modifier_line.

In a Russian game, a tipped arrow or potion showed its effect names in English ("Slowness IV", "Resistance III") among Russian lines. An armour trim showed "Upgrade: / Coast Armor Trim / Redstone Material".

stack_tooltip_lines (game/stations.rs) passed these lines through Enchantments::translate, which holds only en_us.json. The other lines of the same tooltip use translate (Names::display_get), which reads the selected language and falls back to the pinned English names. The effect and trim lines now use that same translator. These were the only lines of the function that used Enchantments::translate.

Vanilla reference

  • PotionContents.addPotionTooltip → getPotionDescription: Component.translatable(MobEffect.getDescriptionId()), wrapped in potion.withAmplifier and potion.withDuration.
  • ArmorTrim.addToTooltip: UPGRADE_TITLE (item.minecraft.smithing_template.upgrade), then the pattern's and the material's description() components.

All of these are translatable components, so they render in the selected language. Read with javap -c on the 26.3 client jar. No harness covers tooltip language.

New test: brewing::tests::effect_lines_read_the_selected_language. It runs the effect lines of a Turtle Master tipped arrow through the prepared ru_ru.json (the real file; skipped without it) and expects "Замедление IV (…" and "Сопротивление III (…".

Before: the same test with main's translator for these lines (Enchantments::load(root).translate, en_us only):

test brewing::tests::effect_lines_read_the_selected_language ... FAILED

After:

test brewing::tests::effect_lines_read_the_selected_language ... ok

Self-check

Run on Windows 11. tools/pr_ready.py and tools/parity.py stop on Windows at signal.SIGHUP, so I ran the steps by hand:

cargo fmt --all -- --check                                                      ok
cargo clippy -p horizon-client --features mods --all-targets -- -D warnings     ok
cargo test -p horizon-client --features mods --lib                              1112 passed, 1 failed*, 32 ignored
cargo test -p horizon-client --features mods --bin horizon-client               139 passed, 3 ignored
python3 tools/check_public_tree.py                                              passed

* save::tests::session_lock_is_exclusive, which fails on Windows on main too.

Screenshots

lang:ru_ru, singleplayer Survival inventory, fast build. I hovered the hotbar slots with horizon-ctl scroll-at X Y 0.

Before (main, 791d8b895): "Slowness IV (0:02)", "Resistance III (0:02)"; "Upgrade:", "Coast Armor Trim", "Redstone Material".
After: "Замедление IV (0:02)", "Сопротивление III (0:02)"; "Улучшение:", "Отделка «Берег»", "Редстоуновая".

The arrow's last line still shows %2$s: -%1$s%. That is the part #3241 fixes.

before: English effect names
after: Russian effect names

before: English trim lines
after: Russian trim lines

Rebased on main after #3186

Rebased on main after #3186 (62a01db8f). brewing.rs moved to crates/horizon-client-render/src/brewing.rs, so the new test is now horizon-client-render's brewing::tests::effect_lines_read_the_selected_language. It still reads the prepared ru_ru.json from .local/horizon-client at the repository root. game/stations.rs stays in horizon-client.

Self-check after the rebase

Run on Windows 11. tools/pr_ready.py and tools/parity.py stop on Windows at signal.SIGHUP, so I ran the steps by hand:

cargo fmt --all -- --check                                                      ok
cargo clippy -p horizon-client-render --all-targets -- -D warnings              ok
cargo clippy -p horizon-client --features mods --all-targets -- -D warnings     ok
cargo test -p horizon-client-render --lib -- brewing::                          3 passed (ru_ru.json present, so the new test ran)
cargo test -p horizon-client --features mods --bin horizon-client               141 passed, 3 ignored

🤖 Generated with Claude Code


🔄 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/3456 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-3312` --- ### 📝 Commits (1) - [`526887b`](https://github.com/horizon-rust/horizon/commit/526887be8915fb6031026e07143890c303483e6d) Tooltips: potion effect and armour trim lines in the selected language ### 📊 Changes **2 files changed** (+28 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/brewing.rs` (+19 -0) 📝 `crates/horizon-client/src/game/stations.rs` (+9 -12) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. ## What and why Part of #3312. The other part, the raw `%2$s: %1$s` attribute lines, is fixed by the open #3241. This PR doesn't touch `modifier_line`. In a Russian game, a tipped arrow or potion showed its effect names in English ("Slowness IV", "Resistance III") among Russian lines. An armour trim showed "Upgrade: / Coast Armor Trim / Redstone Material". `stack_tooltip_lines` (`game/stations.rs`) passed these lines through `Enchantments::translate`, which holds only `en_us.json`. The other lines of the same tooltip use `translate` (`Names::display_get`), which reads the selected language and falls back to the pinned English names. The effect and trim lines now use that same translator. These were the only lines of the function that used `Enchantments::translate`. ## Vanilla reference - `PotionContents.addPotionTooltip` → `getPotionDescription`: `Component.translatable(MobEffect.getDescriptionId())`, wrapped in `potion.withAmplifier` and `potion.withDuration`. - `ArmorTrim.addToTooltip`: `UPGRADE_TITLE` (`item.minecraft.smithing_template.upgrade`), then the pattern's and the material's `description()` components. All of these are translatable components, so they render in the selected language. Read with `javap -c` on the 26.3 client jar. No harness covers tooltip language. New test: `brewing::tests::effect_lines_read_the_selected_language`. It runs the effect lines of a Turtle Master tipped arrow through the prepared `ru_ru.json` (the real file; skipped without it) and expects "Замедление IV (…" and "Сопротивление III (…". Before: the same test with main's translator for these lines (`Enchantments::load(root).translate`, en_us only): ``` test brewing::tests::effect_lines_read_the_selected_language ... FAILED ``` After: ``` test brewing::tests::effect_lines_read_the_selected_language ... ok ``` ## Self-check Run on Windows 11. `tools/pr_ready.py` and `tools/parity.py` stop on Windows at `signal.SIGHUP`, so I ran the steps by hand: ``` cargo fmt --all -- --check ok cargo clippy -p horizon-client --features mods --all-targets -- -D warnings ok cargo test -p horizon-client --features mods --lib 1112 passed, 1 failed*, 32 ignored cargo test -p horizon-client --features mods --bin horizon-client 139 passed, 3 ignored python3 tools/check_public_tree.py passed ``` \* `save::tests::session_lock_is_exclusive`, which fails on Windows on main too. ## Screenshots `lang:ru_ru`, singleplayer Survival inventory, `fast` build. I hovered the hotbar slots with `horizon-ctl scroll-at X Y 0`. Before (main, 791d8b895): "Slowness IV (0:02)", "Resistance III (0:02)"; "Upgrade:", "Coast Armor Trim", "Redstone Material". After: "Замедление IV (0:02)", "Сопротивление III (0:02)"; "Улучшение:", "Отделка «Берег»", "Редстоуновая". The arrow's last line still shows `%2$s: -%1$s%`. That is the part #3241 fixes. ![before: English effect names](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/tooltip-3312-arrow-before.png) ![after: Russian effect names](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/tooltip-3312-arrow-after.png) ![before: English trim lines](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/tooltip-3312-trim-before.png) ![after: Russian trim lines](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/tooltip-3312-trim-after.png) ## Rebased on main after #3186 Rebased on main after #3186 (62a01db8f). `brewing.rs` moved to `crates/horizon-client-render/src/brewing.rs`, so the new test is now `horizon-client-render`'s `brewing::tests::effect_lines_read_the_selected_language`. It still reads the prepared `ru_ru.json` from `.local/horizon-client` at the repository root. `game/stations.rs` stays in horizon-client. ### Self-check after the rebase Run on Windows 11. `tools/pr_ready.py` and `tools/parity.py` stop on Windows at `signal.SIGHUP`, so I ran the steps by hand: ``` cargo fmt --all -- --check ok cargo clippy -p horizon-client-render --all-targets -- -D warnings ok cargo clippy -p horizon-client --features mods --all-targets -- -D warnings ok cargo test -p horizon-client-render --lib -- brewing:: 3 passed (ru_ru.json present, so the new test ran) cargo test -p horizon-client --features mods --bin horizon-client 141 passed, 3 ignored ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:09:26 +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#4994
No description provided.