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

Open
github-bot wants to merge 2 commits from github-bot/gh-2377 into main AGit
Owner

@⁠syfyra on GitHub · 2026-11-26 16:30 UTC · original
syfyra:fix/studio-category-names → main · +95 −10 · 2 files · 2 commits · draft

Claimed in the coordination issue as: STUDIO-CATEGORY-NAMES (#1608)

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

**@⁠syfyra** on GitHub · 2026-11-26 16:30 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2377) `syfyra:fix/studio-category-names` → `main` · +95 −10 · 2 files · 2 commits · draft Claimed in the coordination issue as: STUDIO-CATEGORY-NAMES (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) 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)
viewer/studio.html has an RU/EU switch and an I18N table, but several
of its entries were never applied, so the EU page kept Russian text: the
five stats labels (Модель, Категория, Полигонов, Вершин, Размер файла),
the reset-camera button, the texture gallery heading, the "Все" category
chip, the texture count, and the empty-list messages for models and
textures. The "show all" button and the texture load error had no
entries at all.

Apply them: applyTranslations sets the labels (each is the text node in
front of its value, so the markup stays as it is), the button, the
heading, the chip and the count; the lists, which re-render on a switch,
read their messages from I18N. Two entries are added for the "show all"
button and the load error. The category names and the model download
alert are left for later.

Tested: new test in tests/test_viewer_studio.cjs (fails before the
change, passes after); the existing studio tests pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The studio's I18N table has catNames for both languages ("Транспорт
(Vehicles)" -> "Транспорт" / "Vehicles"), but the category chips and the
model list headers showed the server's two-language name in either
language. Show categoryLabel(cat) there, keep the server's name as the
filter key (and for any name catNames does not list), and relabel the
chips on a language switch; the list headers already re-render.

Builds on #2339 (STUDIO-EU-STRINGS), which applies the other unused
entries of the same table.

Tested: new test in tests/test_viewer_studio.cjs (fails on #2339's head,
passes after); the other studio tests pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 16:35:55 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2377/head:github-bot/gh-2377'
git switch 'github-bot/gh-2377'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2377'
git switch 'github-bot/gh-2377'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2377'
git switch 'github-bot/gh-2377'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2377'
git switch 'main'
git merge --squash 'github-bot/gh-2377'
git switch 'main'
git merge --ff-only 'github-bot/gh-2377'
git switch 'main'
git merge 'github-bot/gh-2377'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.