Skip to content

Add a Traditional Chinese text language (--lang zh-TW) - #422

Draft
tc3oliver wants to merge 2 commits into
aethai:mainfrom
tc3oliver:feat/zh-tw-loc
Draft

tc3oliver wants to merge 2 commits into
aethai:mainfrom
tc3oliver:feat/zh-tw-loc

Conversation

@tc3oliver

@tc3oliver tc3oliver commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

RO3Emu turns the Simplified Chinese strings the client draws into English. With a Traditional Chinese client that leaves a mix of Traditional Chinese (the client's own) and English, and there is no way to ask for Chinese instead. This adds a second language for the in-game text map.

RO3Emu.exe --lang zh-TW:

  • pairs Localization_zh_CN with the client's own Localization_zh_TW from the player's game folder (the publisher's Taiwan wording), the same way the English map pairs it with Localization_en. Nothing from the client is committed;
  • fills what that table lacks from src/Ro3Emu.Setup/translations-zhtw/*.tsv (2,010 rows, same zh<TAB>text format as the English files). Those rows never replace a pair from the client's table. They were drafted from an automatic Simplified-to-Taiwan conversion and corrected against the wording of the client's own zh_TW pairs; text marked (无需翻译) (designer and test strings) is left out;
  • English stays the default. --lang is remembered in RO3Emu.settings.json. The generated map records its language in its first line (the # zh en - generated by prefix is unchanged, so ClientPatcher still recognises it), and start/host/join rebuild it once when the language changed. After an export the map is only rebuilt for a language change.

A user who never passes --lang gets the same map, the same export and the same failure rules as before: the zh_TW chunk is an export table only in zh-TW mode.

Why the translations are in src/Ro3Emu.Setup and not next to the English ones in src/Ro3Emu.Loc: that folder is part of the stamp of prebuilt/client (tools/release/client-stamp.ps1), and these texts are not in those DLLs, so adding them there would force a DLL refresh for nothing.

Checked:

  • dotnet test tests/Ro3Emu.Setup.Tests: 157 passed, 9 skipped. New tests cover the zh_TW pairing, the stored language, the --lang values and the shape of the embedded translations.
  • dotnet format whitespace, tools/AnalyzerBaseline (CA1861 baseline 100 -> 99, the count went down), the server build, and the prebuilt/client stamp (this PR touches nothing the stamp covers).
  • RO3Emu.exe export <game> <data> --lang zh-TW on a real release 140083 client: 27,276 texts in 36 s.

Known limits:

  • Exact strings work. Strings the client composes at run time (a template with a number, or text with a Chinese name inside) are mapped by Ro3Loc in the client DLL, which only accepts a result without Chinese in it. In zh-TW mode those stay as the client draws them. Fixing that is a small change in src/Ro3Emu.Loc/Ro3Loc.cs, but it needs the prebuilt DLLs rebuilt, and my build of the current sources does not reproduce the committed DLL bytes, so I left it out. I can send it as a follow-up, with prebuilt/client rebuilt on your side.
  • I have not looked at the running game yet, hence the draft.
  • The web panel (admin pages) is English only; that would be a separate change.

The in-game text map turned the client's Simplified Chinese strings into
English only. With --lang zh-TW it pairs them with the client's own
Localization_zh_TW instead (the publisher's Taiwan wording), and fills
what that table lacks from src/Ro3Emu.Loc/translations-zhtw.

English stays the default. The choice is remembered in the settings, and
the map records its language in its first line so it is rebuilt once
when the language changes.
- Keep the translations in src/Ro3Emu.Setup: src/Ro3Emu.Loc is part of the
  stamp of the prebuilt client DLLs, which these texts are not in.
- Drop the 1,758 rows for text marked as not needing translation (designer
  and test strings); fix 十字斬首者, 回饋 and 鏡頭 to the client's own wording.
- Our rows fill what the client's zh_TW table lacks and no longer replace it.
- The Localization_zh_TW chunk counts as an export table only for zh-TW, so
  English users see no change in what makes an export incomplete.
- After an export, rebuild the map only when its language changed.
- Do not crash when --lang cannot be saved; read the setting case-insensitively.

This branch has not been deployed

No deployments
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