Repository navigation
feat(i18n): the shortcut rows speak Chinese - #391
Merged
Merged
Conversation
The Shortcuts settings page and the ⌘/ cheat sheet drew their row labels and hints from English strings in lib/shortcuts.ts, so a Chinese UI showed a Chinese page whose every row was English. The page's own chrome (subtitle, Reset all, the conflict note) had locale entries; the rows under it did not. The copy moves into the locale files (settings:shortcuts.*) and lib/shortcutCopy.ts becomes the id -> key map plus the accessors both surfaces read. One copy is the only way the settings list and the sheet cannot disagree about what a command is called, and a new ShortcutId is a compile error until it has a key there. The registry keeps structure only (ids, groups, bindings, glyphs) and DOUBLE_SHIFT_MODES / CTRL_TAB_MODES become id lists. English text is unchanged, word for word, so the specs that assert on it stay valid. Keys built from a table are invisible to usedKeys.test.ts (literals only) and to parity.test.ts (en against zh-CN only: a row missing from BOTH passes it), so shortcutCopy.test.ts pins them, and i18n.e2e.ts gains a case that opens the page in Chinese and reads the rows back. Follow-up to simion#330. Co-Authored-By: Claude Code <noreply@anthropic.com>
Contributor
Author
simion
approved these changes
Oct 10, 2026
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.

The Shortcuts settings page was half translated: its own chrome (the subtitle, Reset all, the conflict note) had locale entries from #330, and every row under it did not. Those row labels and hints were English strings in
src/lib/shortcuts.ts, so a Chinese UI drew a Chinese page whose whole list was English. The ⌘/ cheat sheet draws the same rows and was in the same state.This moves that copy into the locale files, under
settings:shortcuts.*, and addssrc/lib/shortcutCopy.tsas the id to key map plus the accessors both surfaces read. One copy is the only way the settings list and the sheet cannot disagree about what a command is called, and a newShortcutIdis a compile error until it has a key there.Shortcut ids are untouched: they are what prefs stores the binding map under, so nothing migrates. English is unchanged word for word, which keeps the specs that assert on it valid.
Pieces:
lib/shortcutCopy.ts: aRecord<ShortcutId, string>key table, the{{cmd}}style chord variables the hints interpolate, and the accessors (shortcutLabel,shortcutHint,shortcutGroupLabel,fixedShortcut*,doubleShiftModeLabel,ctrlTabModeLabel).lib/shortcuts.ts: the registry dropslabel/hint/fixedReasonand keeps structure (ids, groups, bindings, glyphs).DOUBLE_SHIFT_MODESandCTRL_TAB_MODESbecome id lists.locales/{en,zh-CN}/settings.ts: copy for 43 rows, the 2 fixed gestures, the mode selects and the group headings.lib/shortcutCopy.test.ts: keys built from a table are invisible tousedKeys.test.ts(literals only) and toparity.test.ts(en against zh-CN only, so a row missing from BOTH passes it), which is exactly the failure that would ship here: a row drawing its own key on screen.e2e/specs/i18n.e2e.ts: a case that opens the page in Chinese and reads the row labels and the mode select's options back, with an English control beside it.Two strings stay English on purpose:
lib/lsp/featureName.ts), it follows the type-checking switch, and four other surfaces call it that. A second name for it here is the drift that file exists to prevent, so localizing the feature name itself is its own change.Suites:
npm test3104 passed,npm run typecheck:e2eclean, ande2e/specs/i18n.e2e.tsgreen at 7 cases including the new one. The fullmake e2erun reported 29 of 31 spec files passing with two failing; I could not read which two (the log was tailed) and could not re-run them afterwards, because a dev build had replaced the e2e binary. The shortcut-related specs should be read as verified, the rest of that run as unverified here.Screenshots: the e2e case writes two,
.e2e/artifacts/settings-shortcuts-en.png(the English page, unchanged) andsettings-shortcuts-zh.png(the Chinese one, rows and all). The upload API refuses from this setup, so they still need a drag and drop into this description.Manually tested by hand: the Shortcuts page was opened in Chinese and reads as it should. The screenshots come from the e2e run.
Co-Authored-By: Claude Code noreply@anthropic.com