Skip to content

feat(i18n): add Traditional Chinese (zh-TW) - #481

Merged
t8y2 merged 6 commits into
t8y2:mainfrom
New-Moore:feat/zh-tw
Nov 5, 2026
Merged

t8y2 merged 6 commits into
t8y2:mainfrom
New-Moore:feat/zh-tw

Conversation

@New-Moore

@New-Moore New-Moore commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Closes #478

按 #90 中"按语言逐批引入"的方向,只加入繁体中文一种,不包含 #90 的下拉框和图标。

改动

  • 语言设置增加"繁體中文",选择后保存,重启恢复。
  • 系统语言为 zh-TW、zh-HK、zh-MO 或 zh-Hant 时,首次启动使用繁体;这些系统此前显示简体(已更新对应测试)。zh-Hans-TW 这类明确写了文字的标签仍以文字为准。
  • internal/i18n/traditional.go 由 tools/zhtw/gen.py 从简体目录生成,使用 OpenCC(s2twp)加一份台湾用语术语表。
  • 启动失败和二次启动的提示、主机标签的默认选项增加繁体版本。
  • 智谱和 MiniMax 的预设在繁体界面使用国际站地址,urlZH 仍只用于简体界面。
  • 识别密码和验证码提示的关键词增加繁体写法(cmdhistory、otp、自动填充的 sudo/su 预设)。此前繁体提示不会被这些文字过滤器识别;不回显的输入本来就不会被记录,所以这里补的是会回显的提示。

维护成本与体积

  • 新增文案只需要维护简体,再运行一次生成脚本:python tools/zhtw/gen.py && gofmt -w internal/i18n/traditional.go。译法要改术语表,不要直接改生成的文件。
  • 漏生成时,TestEveryLanguageFillsEveryMessage 会失败;另有测试检查格式参数一致、目录中没有简体字。
  • Windows amd64 构建增加约 160 KiB(49,211,904 → 49,375,232 字节,基于 637acde 测量)。目录是静态数据,没有首次解码。
  • Python 和 OpenCC 只在重新生成时需要,正常构建和运行不需要。

验证

环境:Windows 11,Go 1.27.3,Viva 71a9824,基于 b04fcdc。

  • gofmt -l 无输出,go vet ./... 和 go vet -tags dev ./internal/workbench 通过。
  • 重新生成目录后没有差异。
  • 新增和相关测试通过:internal/i18n、internal/cmdhistory、internal/otp,以及 workbench 的语言选择、设置、自动填充和主机标签测试。
  • go test ./... 有以下失败,相同测试在干净的 main(637acde)上同样失败:
    • cmd/motty:TestSecondLaunchHandsOffWithoutOpeningStorage、TestClaimIdentityCanonicalizesDataDirectories、TestClaimIdentityCanonicalizesCaseAliases、TestHeadlessNeedsAnExplicitNonDefaultDataDirectory
    • internal/ai/probe:TestProbeModelChatStreamFirstToken
    • internal/remotetools:TestGuardedShellChecksBootAndTicksBeforeEveryMutation、TestIdentityProbeDoesNotInterpretProcessCommandAsShell、TestGuardedStatPrefixValidatesStateAndNumericFieldTypes
    • internal/sessionlog:TestStoreOpensAHomePathContainingSQLiteURICharacters
    • internal/sshconn:TestPingConnected、TestPingSendsNothingWhileAnEarlierProbeIsUnanswered
    • internal/workbench:TestLocalProxyCommandsRestorePreviousShellEnvironment、TestLocalProxyCommandsDoNotOverwriteForeignBackup、TestLocalProxyCommandsDoNotOverwriteStrayBackups、TestLocalListShowsApplicationBundlesWithTheirSystemIcon
    • tools/releaseprep:TestPrepareBumpsBothVersionFiles、TestPrepareBlocks
  • TestWindowsRemoteProcessScriptOnRealCIM 在本分支全量运行时失败两次,单独运行时本分支和 main 都是 3/3 通过;remotetools 不依赖本次改动的包。

未验证:

  • go test -race ./...:本机没有 C 编译器(CGO_ENABLED=0),未运行。
  • macOS 和 Linux 真机。
  • 翻译未逐条人工校对,只检查了高频词和容易转错的字。
  • 界面仅检查了设置页,其他页面尚未逐页检查;语言切换同时由测试覆盖。

截图

设置页的语言选项和繁体中文界面

New-Moore and others added 6 commits November 5, 2026 01:19
Add a third language to the settings picker. Systems reporting zh-TW,
zh-HK, zh-MO or zh-Hant now start in Traditional Chinese instead of the
Simplified catalog.

internal/i18n/traditional.go is generated from the Simplified catalog by
tools/zhtw/gen.py, which runs OpenCC and then a glossary of Taiwanese
software terms, so upstream strings reach zh-TW by regenerating.

Also match Traditional wording in the wording-based prompt checks: the
command history filter, the autofill sudo/su presets and one-time code
detection. Input at a prompt that does not echo was already never
recorded, so the history filter only adds cover for prompts that echo.
Add four words to the zh-TW glossary and regenerate: 背景, 系統匣,
開機時啟動 and 金鑰. The keys page was 金鑰鏈, too close to 鑰匙圈, which is
the system keychain.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alog

Add code_editor.go to the generator's catalogs and map the new strings to
Taiwanese terms (尋找, 取代, 產生, 定位字元).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	internal/workbench/workbench.go
@t8y2
t8y2 merged commit de87f59 into t8y2:main Nov 5, 2026
@t8y2

t8y2 commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Thanks for the contribution! Merged in de87f59, will be released in the next version.

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.

feat(i18n): 能否把繁体中文作为第一批增量语言?

4 participants