test(i18n): check every key that exists, not a copy of the list

The parity guard walked a hand-maintained list of 900 keys. A key added
without being added there was checked by nobody, and the list had drifted
— that is exactly how eleven values ended up shipping as their English
originals in zh and ja.

The enum is now emitted by a macro that also emits L10nKey::ALL, so there
is one list and the compiler reads it. The guard sweeps ALL and, on top
of the non-empty checks it already made, fails on a translation that is
byte-identical to the English. What that must not catch is spelled out
in KEPT_IN_ENGLISH with a reason each: protocol names, pure templates,
product names, a language named in its own language, and the
shell / agent / ssh set that would read worse half-translated.

Also translates what the new check found and should not have kept:
ja "bind" / "to" in a form whose other labels are Japanese (zh had
already done both), and Stable / Nightly in zh and ja.

Net −850 lines.
This commit is contained in:
l0ng-ai
2026-08-08 02:46:41 +08:00
parent 1f91719da9
commit 10e2bae2fe
3 changed files with 72 additions and 922 deletions
+4 -4
View File
@@ -485,8 +485,8 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
L10nKey::SettingsUpdateChannelDesc => {
"Stable は正式リリースを、Nightly は最新のコードから毎晩ビルドされる版を追いかけます。新しい代わりに、リリース前のテストは経ていません。"
}
L10nKey::SettingsUpdateChannelStable => "Stable",
L10nKey::SettingsUpdateChannelNightly => "Nightly",
L10nKey::SettingsUpdateChannelStable => "安定版",
L10nKey::SettingsUpdateChannelNightly => "ナイトリー",
L10nKey::SettingsDaemonStale => "バックグラウンドサービスは {build} のままです。",
L10nKey::SettingsDaemonStaleDesc => {
"tty7 はその場で更新されたため、アプリは新しくなりましたが、各ペインは以前のビルドのサービスが処理しています。サービスを再起動すると新しいビルドに切り替わりますが、ペインで動いているプロセス(シェル、エージェント、SSH セッション)はすべて終了します。急ぐ必要はありません。ペインが空いているときに実行してください。"
@@ -776,8 +776,8 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
L10nKey::ForwardLocal => "ローカル",
L10nKey::ForwardRemote => "リモート",
L10nKey::ForwardDynamic => "ダイナミック",
L10nKey::ForwardBindLabel => "bind",
L10nKey::ForwardToLabel => "to",
L10nKey::ForwardBindLabel => "バインド",
L10nKey::ForwardToLabel => "転送先",
L10nKey::ForwardSocksLabel => "SOCKS",
L10nKey::ForwardAdd => "追加",
L10nKey::FileTreePlaceholderFileName => "ファイル名",
+66 -916
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -428,8 +428,8 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
L10nKey::SettingsUpdateChannelDesc => {
"Stable 跟随正式发布的版本,Nightly 跟随每晚从最新代码构建的版本——更新更快,但没有经过发布测试。"
}
L10nKey::SettingsUpdateChannelStable => "Stable",
L10nKey::SettingsUpdateChannelNightly => "Nightly",
L10nKey::SettingsUpdateChannelStable => "稳定版",
L10nKey::SettingsUpdateChannelNightly => "每夜构建",
L10nKey::SettingsDaemonStale => "后台服务仍运行在 {build}。",
L10nKey::SettingsDaemonStaleDesc => {
"tty7 是原地升级的,界面已经是新版本,但各个 pane 仍由旧版本的后台服务托管。重启服务才能用上新版本,代价是 pane 里正在跑的进程全部结束——shell、agent、SSH 会话都算。不急,挑个 pane 空闲的时候再重启。"