Skip to content

Add simplified Chinese UI localization - #70

Open
xmx-emm wants to merge 4 commits into
r-ex:mainfrom
xmx-emm:feat/i18n-zh-cn
Open

Add simplified Chinese UI localization#70
xmx-emm wants to merge 4 commits into
r-ex:mainfrom
xmx-emm:feat/i18n-zh-cn

Conversation

@xmx-emm

@xmx-emm xmx-emm commented Jul 20, 2026

Copy link
Copy Markdown

Summary

This PR adds an optional simplified Chinese translation for the RSX user interface, implemented so that english users see zero behaviour change.

How it works

A small localization layer is introduced in core/i18n.h / core/i18n.cpp:

  • TR(text) looks up the english source string in the active language's string table and returns the translation, falling back to the original pointer when no translation exists (or when the language is english). Returned pointers have static storage duration, so they are safe to keep around (e.g. progress bar event names).
  • TRW(windowName) is used for window titles. For non-english languages it returns "<translated>###<english name>" so the ImGui window id stays language independent: dock layout, imgui.ini window data and the DockBuilder references in render.cpp keep working when the language changes. For english it returns the original pointer unchanged.
  • TRCombo(...) wraps ImGui::Combo and translates each item, which lets the per-asset export format arrays ("PNG (Highest Mip)", ...) stay untouched in all 30+ asset type files - translations live only in the string table.

What is covered

Main menu bar, welcome dialog, asset list (export menu, table headers, context menu, filter hint), asset info, the whole settings window including help markers, skin finder, logs window, progress bar events, toast notifications and asset type display names.

A language selector was added to Settings > General; the selection persists via the existing UtilSettings imgui.ini handler (Language=N).

Supporting changes

  • The project now compiles with /utf-8 (all four configurations). Translated literals are stored as UTF-8 and MSVC would otherwise interpret them using the local codepage. All existing sources are ASCII (or already valid UTF-8), so this is a no-op for them.
  • CJK font: prefer msyh.ttc (Microsoft YaHei) over simsun.ttc when present, as it is much more legible at 18px; SimSun remains the fallback. The Chinese glyph ranges were already being loaded.
  • The singular/plural toast ("Exported %lld asset%s!") was split into two full sentences so languages without plural suffixes translate cleanly.

Adding another language

Add an entry to eUILanguage, a display name to s_UILanguageNames and a string table in i18n.cpp. Untranslated strings gracefully fall back to english.

Test plan

  • Full rebuild of Release_CI succeeds (warnings-as-errors, /W4)
  • Switch language English <-> Chinese in Settings > General, dock layout survives
  • Translated windows, menus, settings, progress bars and toasts render correctly with the merged CJK font
  • English UI unchanged compared to main

xmx-emm and others added 4 commits July 20, 2026 22:00
Introduces a lightweight i18n layer (core/i18n.h, core/i18n.cpp):
- TR(): translates UI strings with graceful fallback to the english
  source text when no translation exists
- TRW(): window titles keep stable ImGui ids across languages via the
  '###' suffix, so dock layout and imgui.ini survive language switches;
  returns the original pointer for english (zero behaviour change)
- TRCombo(): ImGui::Combo wrapper that translates combo items

Wired up for the main shell UI: menu bar, welcome dialog, asset list,
asset info, settings window (incl. all help markers), skin finder,
logs window, progress bar events and toast notifications.

A language selector was added to Settings > General and the choice is
persisted through the UtilSettings imgui.ini handler.

CJK font: prefer msyh.ttc (Microsoft YaHei) over simsun.ttc when
available, since it is far more legible at UI point sizes; simsun
remains the fallback. Chinese glyph ranges were already loaded.

The project is now compiled with /utf-8 so translated string literals
(stored as UTF-8) are interpreted correctly by MSVC.

Co-authored-by: Cursor <cursoragent@cursor.com>
Covers the remaining user-facing strings in the per-asset preview
panels:

- texture: mip level table (headers, status, perm/streamed/opt
  streamed types), array index label, texture preview overlay
  (scale/zoom hint/streaming error text)
- ui image, ui image atlas, ui font atlas: table headers, quality
  labels, dimension/tile info rows, preview overlays
- material: type/shaderset/snapshot rows, shader type help text,
  textures/properties tabs, texture table headers and status column
- model: bone/lod/sequence counts, LOD slider, skin/bodypart/model
  selectors, full sequence player (play/pause/stop/loop/frame),
  animrig/animseq desc rows
- audio: sample rate row
- logs window: level column values (INFO/WARNING/ERROR)

All translated through the existing TR() table lookup; ids that embed
labels keep their english part behind '##' so no state is lost when
switching languages.

Co-authored-by: Cursor <cursoragent@cursor.com>
Covers the last user-facing english strings in the less common asset
previews: settings layout (parent/sub-layout navigation and field
table), shader and shader set info rows, subtitles table, datatable
row/column count, rson root type, rui arg cluster info and arg table,
texture list headers, model rig/sequence counts, material snapshot,
material blend state tree, rtk element info, odl and wrap preview
notices, and the 'txtr not registered' notices.

Log message *content* is intentionally left in english: those strings
end up in logs and bug reports where grep-ability and upstream
readability matter more than translation. Only the log level names
(INFO/WARNING/ERROR) shown in the Logs window are translated.

Co-authored-by: Cursor <cursoragent@cursor.com>
Progress windows recorded a start time and now show an estimated
remaining duration once enough work has completed. Remove NoMove so
the dialog can be repositioned after it first appears centered.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant