Add simplified Chinese UI localization - #70
Open
xmx-emm wants to merge 4 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.iniwindow data and the DockBuilder references inrender.cppkeep working when the language changes. For english it returns the original pointer unchanged.TRCombo(...)wrapsImGui::Comboand 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
UtilSettingsimgui.ini handler (Language=N).Supporting changes
/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.msyh.ttc(Microsoft YaHei) oversimsun.ttcwhen present, as it is much more legible at 18px; SimSun remains the fallback. The Chinese glyph ranges were already being loaded."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 tos_UILanguageNamesand a string table ini18n.cpp. Untranslated strings gracefully fall back to english.Test plan
Release_CIsucceeds (warnings-as-errors, /W4)main