[codex] Add localization support and Chinese translation - #227
Open
5151561 wants to merge 6 commits into
Open
Conversation
5151561
marked this pull request as ready for review
May 17, 2026 20:24
Author
|
@ToastedOven |
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 localization support for LookingGlass-owned UI text and ships an initial Chinese translation.
LookingGlass/Languages.schinese,zh, andzh_CNfor Chinese language resolution.How It Works
The implementation adds
LookingGlassLanguageAPIas a small localization layer for text owned by LookingGlass itself.LookingGlass/Languages/{languageName}/LookingGlass.jsonand use stableLG_TOKEN_*keys.LookingGlassLanguageAPI.Init(...)registers the bundledLanguagesroot with RoR2 throughLanguage.collectLanguageRootFolders, so the game can load the same token set through its normal language system.GetString,ConfigName,ConfigDescription,ConfigCategory, and item/stat label helpers instead of hardcoding user-facing English text.Why This Supports Multiple Languages
The code no longer depends on Chinese-specific replacements. It resolves text through language tokens and language folders, with English as the fallback language.
zh-CNis just the first non-English language folder shipped with the mod.Adding another language does not require changing every UI call site again. New translations can provide the same
LG_TOKEN_*keys under another language folder, and the runtime will select that folder when RoR2 reports the matching language name.Adding Another Language
To adapt another language, for example Japanese:
LookingGlass/Languages/en/LookingGlass.jsontoLookingGlass/Languages/ja/LookingGlass.json.LookingGlassLanguageAPI.languageAliases.bash scripts/validate-localization.shand build the package.Chinese Support
The PR includes a
zh-CNtranslation for the added LookingGlass UI, including the Stats Display panel and the Stats Display options page. The implementation was manually tested in a Chinese game environment, including the previously problematic options page text and dropdown choices.AI Assistance Disclosure
This change was implemented and reviewed with AI assistance from Codex. Final behavior was manually checked by the maintainer/user in-game.
Validation
bash scripts/validate-localization.shdotnet build LookingGlass.sln --configuration Debugdotnet build LookingGlass.sln --configuration ReleaseLookingGlass.dlland bothLanguages/en/LookingGlass.jsonandLanguages/zh-CN/LookingGlass.jsonNotes
The build still reports the existing project warnings for deprecated RoR2 APIs and unused fields; no new build errors were introduced.