studio: show category names in the chosen language (STUDIO-CATEGORY-NAMES) #2377

Merged
syfyra merged 2 commits from upstream-pr/2377 into main 2026-12-02 13:26:04 +00:00
syfyra commented 2026-11-26 16:30:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by syfyra on 2026-11-26T16:30:46Z.


Claimed in the coordination issue as: STUDIO-CATEGORY-NAMES (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7197726846)

Depends on: #2339 (STUDIO-EU-STRINGS). This branch is built on it, so the diff here shows both commits; the change of this pull request is the last commit, 45a128d32. Once #2339 lands, only that commit remains.

What and why

viewer/studio.html (served by tools/gallery.py) has a catNames entry in both languages of its I18N table. tools/gallery.py names each category in both languages ("Транспорт (Vehicles)"); catNames maps that to "Транспорт" for RU and "Vehicles" for EU. Nothing read catNames, so the category chips and the model list headers showed the server's two-language name whatever the language. It is the last unused entry of the table: #2339 applies the others and left this one out because the chips are built once per load.

  • The chips and the list headers now show categoryLabel(cat), which is catNames[cat] of the current language, or the server's name when catNames has no entry for it.
  • The server's name stays the filter key (selectCategory, activeCategory, the search), so filtering is unchanged.
  • The chips are relabelled on a language switch from a small list kept when they are built. The list headers already re-render on a switch.

Tested

Windows 11, Node 26.12.1, no game files:

  • node --test tests/test_viewer_studio.cjs: 14 pass. The new test builds chips and the list for Транспорт (Vehicles) and an unlisted Custom. It checks Транспорт (1) / Custom (1) and the headers in RU, then Vehicles (1) / Custom (1) after setLanguage('eu'), then that selecting the chip filters by the server's name. It fails on #2339's head; the other 13 pass.
  • Merges cleanly with the open studio PRs #1138, #1490, #2100, #2136, #2250 and with #2335.
  • scripts/check_no_game_data.py on both files.

GPUs tested: n/a (no GPU code)

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5513708618 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2377). Originally posted by [syfyra](https://github.com/syfyra) on 2026-11-26T16:30:46Z. --- Claimed in the coordination issue as: STUDIO-CATEGORY-NAMES (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7197726846) Depends on: #2339 (STUDIO-EU-STRINGS). This branch is built on it, so the diff here shows both commits; the change of this pull request is the last commit, 45a128d32. Once #2339 lands, only that commit remains. ### What and why `viewer/studio.html` (served by `tools/gallery.py`) has a `catNames` entry in both languages of its `I18N` table. `tools/gallery.py` names each category in both languages (`"Транспорт (Vehicles)"`); `catNames` maps that to `"Транспорт"` for RU and `"Vehicles"` for EU. Nothing read `catNames`, so the category chips and the model list headers showed the server's two-language name whatever the language. It is the last unused entry of the table: #2339 applies the others and left this one out because the chips are built once per load. - The chips and the list headers now show `categoryLabel(cat)`, which is `catNames[cat]` of the current language, or the server's name when `catNames` has no entry for it. - The server's name stays the filter key (`selectCategory`, `activeCategory`, the search), so filtering is unchanged. - The chips are relabelled on a language switch from a small list kept when they are built. The list headers already re-render on a switch. ### Tested Windows 11, Node 26.12.1, no game files: - `node --test tests/test_viewer_studio.cjs`: 14 pass. The new test builds chips and the list for `Транспорт (Vehicles)` and an unlisted `Custom`. It checks `Транспорт (1)` / `Custom (1)` and the headers in RU, then `Vehicles (1)` / `Custom (1)` after `setLanguage('eu')`, then that selecting the chip filters by the server's name. It fails on #2339's head; the other 13 pass. - Merges cleanly with the open studio PRs #1138, #1490, #2100, #2136, #2250 and with #2335. - `scripts/check_no_game_data.py` on both files. GPUs tested: n/a (no GPU code) AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
imShangLi commented 2026-12-01 05:02:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-12-01T05:02:33Z.


VERIFY-2377 — Linux, node v22.23.1, CPU only, no game files

Claimed as VERIFY-2377.

tree node tests/test_viewer_studio.cjs
main 86c30fce 16 tests, 16 pass
main + this pull request 18 tests, 18 pass
main + only this pull request's test change 18 tests, 16 pass, 2 fail

Row 3's two failures are exactly the two tests this pull request adds, and both are AssertionErrors rather than load errors:

not ok 8 - switching to EU relabels the stats panel, the buttons, the texture gallery and the empty lists
not ok 9 - category chips and headers show the catNames of the chosen language and keep the server name as the filter
    code: 'ERR_ASSERTION'   name: 'AssertionError'

So without viewer/studio.html's change both new tests fail, and with it they pass while the 16 tests that were already on main still pass. Reverse control holds.

How row 3 had to be built, and the trap it avoided

This branch's base (73516a29) predates four tests that main has since added to the same file. Checking the branch's version of tests/test_viewer_studio.cjs onto main gives 14 tests, not 18:

  • four main tests silently disappear from the row;
  • two pre-existing tests then fail, and the failure text is a TypeError (controls.saveState is not a function) because main's studio.html has moved on — unrelated to this change.

That row would have looked like a stronger failure than the change actually produces, and it would have been wrong. Row 3 is instead main's file with only the pull request's 54 added lines patched in (16 + 2 = 18), so the row contains the change and nothing else.

For the record, that makes #2377 another stale-base case rather than a defect: it merges cleanly and the merge result is what row 2 tested.

What is not covered here

viewer/studio.html is exercised through the extracted <script> in a vm context, so the HTML and CSS are not rendered — this is script-level behaviour only. Nothing about layout, and no browser.

Verified. Nothing found against it; merges cleanly with main 86c30fce.

AI-assisted: yes — MiMo-V2.6-Flash (OpenCode). It built the worktrees, patched row 3, ran the runner and drafted this report.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7301362287 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2377#issuecomment-7301362287). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-12-01T05:02:33Z. --- ### VERIFY-2377 — Linux, node v22.23.1, CPU only, no game files Claimed as `VERIFY-2377`. | tree | `node tests/test_viewer_studio.cjs` | |---|---| | `main` `86c30fce` | 16 tests, 16 pass | | `main` + this pull request | 18 tests, **18 pass** | | `main` + **only this pull request's test change** | 18 tests, 16 pass, **2 fail** | Row 3's two failures are exactly the two tests this pull request adds, and both are `AssertionError`s rather than load errors: ``` not ok 8 - switching to EU relabels the stats panel, the buttons, the texture gallery and the empty lists not ok 9 - category chips and headers show the catNames of the chosen language and keep the server name as the filter code: 'ERR_ASSERTION' name: 'AssertionError' ``` So without `viewer/studio.html`'s change both new tests fail, and with it they pass while the 16 tests that were already on `main` still pass. Reverse control holds. #### How row 3 had to be built, and the trap it avoided This branch's base (`73516a29`) predates **four tests that `main` has since added to the same file**. Checking the branch's version of `tests/test_viewer_studio.cjs` onto `main` gives 14 tests, not 18: - four `main` tests silently disappear from the row; - two pre-existing tests then fail, and the failure text is a `TypeError` (`controls.saveState is not a function`) because `main`'s `studio.html` has moved on — unrelated to this change. That row would have looked like a stronger failure than the change actually produces, and it would have been wrong. Row 3 is instead `main`'s file with **only the pull request's 54 added lines** patched in (16 + 2 = 18), so the row contains the change and nothing else. For the record, that makes #2377 another stale-base case rather than a defect: it merges cleanly and the merge result is what row 2 tested. #### What is not covered here `viewer/studio.html` is exercised through the extracted `<script>` in a `vm` context, so the HTML and CSS are not rendered — this is script-level behaviour only. Nothing about layout, and no browser. **Verified.** Nothing found against it; merges cleanly with `main` `86c30fce`. AI-assisted: yes — MiMo-V2.6-Flash (OpenCode). It built the worktrees, patched row 3, ran the runner and drafted this report.
aslan2142 commented 2026-12-01 11:51:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:51:12Z.

Review: COMMENTED


Draft review note: STUDIO-CATEGORY-NAMES is still a draft with no CI run and is stacked on unmerged draft #2339 (STUDIO-EU-STRINGS). Once #2339 merges, please rebase so only commit 45a128d remains, run CI to green, and mark ready for review.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130680298 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2377#pullrequestreview-6130680298). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:51:12Z. **Review:** COMMENTED --- Draft review note: `STUDIO-CATEGORY-NAMES` is still a draft with no CI run and is stacked on unmerged draft `#2339` (`STUDIO-EU-STRINGS`). Once `#2339` merges, please rebase so only commit `45a128d` remains, run CI to green, and mark ready for review. *(AI-assisted review.)*
MoonEyes commented 2026-12-02 10:32:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T10:32:49Z.


For information: this pull request is carried in #3094, which merges your head (your commits are kept) into current main, resolves the conflicts keeping both sides, and fixes the points raised in review here (details in its description). This one stays open until a maintainer decides; if you pick it up again, say so and the carry can be closed.

AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7342628600 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2377#issuecomment-7342628600). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T10:32:49Z. --- For information: this pull request is carried in #3094, which merges your head (your commits are kept) into current `main`, resolves the conflicts keeping both sides, and fixes the points raised in review here (details in its description). This one stays open until a maintainer decides; if you pick it up again, say so and the carry can be closed. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!2377
No description provided.