Repository navigation
Translate the app menu's standard items, which Electron labels in English - #664
Merged
Merged
Conversation
…lish A menu item built from a role takes its label from Electron's own English defaults, so only Settings…, Open App Log and Show Logs Folder were translated. Every menu title and every other item stayed English in every language. Each item now has a label of ours, and the role still supplies its action and shortcut. Giving a role a submenu drops its default items, so Edit, View, Window and File on macOS are written out item by item as Electron 43 has them on each platform, with About, Hide and Quit naming the app as Electron's labels do. The en-XA journey now checks every menu item that is not a separator. Fixes #657
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 46 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Collaborator
Author
|
@coderabbitai review |
|
zaerl
approved these changes
Oct 8, 2026
zaerl
left a comment
Contributor
There was a problem hiding this comment.
Tested on macOS and Windows. 👍
ryanwelcher
added a commit
that referenced
this pull request
Oct 13, 2026
## Why 41 commits have reached trunk since `v1.2.1`, and milestone `v2.0.0-beta.1` has 77 closed issues and none open. The main changes are the redesign on the WordPress Design System (#591), a settings dialog with language, theme, PHP version and debug flags (#638 to #651), and translation of the whole interface (#634 to #664). This is a beta: it ships with `--prerelease`, so `releases/latest` stays on `v1.2.1`. `electron-builder` names the artifacts after `package.json`, so the version has to move before the tag and artifacts exist. ## What changes - **The version.** The three root version fields in `package.json` and `package-lock.json` move from `1.2.1` to `2.0.0-beta.1`. No dependency versions change. - **The first shipped translations.** `npm run i18n:download` added a catalog for each of the seven locales at 80% or more on translate.wordpress.org. None was removed, and no right-to-left locale was held back. | Locale | Translated | Strings | | --- | --- | --- | | cs | 94% | 1001 | | en-ca | 100% | 1062 | | en-gb | 100% | 1062 | | gl | 100% | 1062 | | hu | 100% | 1062 | | nl | 100% | 1062 | | pl | 96% | 1028 | ## How to test this **Platforms:** any for steps 1 to 3. The artifact checks need macOS for `Info.plist` and Windows for the `.exe`. **Starting state:** this branch checked out with `node_modules` installed. Run every command from the repository root. 1. `npm run lint` is clean and `npm test` passes. 2. `node -e "console.log(require('./package.json').version)"` prints `2.0.0-beta.1`. 3. `python3 -c "import json;d=json.load(open('package-lock.json'));print(d['version'], d['packages']['']['version'])"` prints `2.0.0-beta.1 2.0.0-beta.1`. 4. On the Buildkite build for the current head, the artifacts are named `wordpress-contributor-toolkit-2.0.0-beta.1-*`. The `app.asar` root holds exactly `node_modules`, `package.json` and `src`, with npm 11 under `node_modules/npm` and no `.codesigning`. On macOS, `CFBundleShortVersionString` reads `2.0.0-beta.1`. 5. In the installed app, set the language to Dutch in the settings and relaunch. The interface is in Dutch. **What must not have happened:** no dependency version may change. `git diff trunk -- . ':!src/languages'` shows exactly three changed lines, all of them the root version. ## Risks and limitations `npm test` run from an interactive terminal fails two integration tests on macOS. That is a test bug, fixed separately in #680. It does not affect CI or the app. ## Related Milestone `v2.0.0-beta.1`. Release notes follow on the release. --- <details> <summary>Review outcome (required — see AGENTS.md)</summary> 0 [fix here] · 0 [follow-up]. Automatic checks only, as in #533: this change has no logic to review. - **Review:** completed, deterministic layer, in session; head `9853082` / base `5d5f701` (trunk). `npm run lint` passes, `npm test` passes (2098 tests, 0 failures, 2 skipped), both files are valid JSON, and the diff outside `src/languages/` is the three root version fields. Outcome: nothing to fix. - **Since review:** none. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Why
The app menu is built from Electron roles, and a role item takes its label from Electron's own English. So only three items were translated (Settings…, Open App Log, Show Logs Folder). Every menu title and every other item stayed in English in every language. Found in the en-XA walk.
What changes
Root cause: role items had no
label, so Electron filled in its English default.src/menu.jsnow has alabel: __('…'). The role still supplies the action and the shortcut, and only the label is overridden.sprintfwith a translator comment, withapp.namepassed in frommain.js). Quit is "Exit" on Windows and "Quit" on Linux. Window's "Close" is "Close Window" under File on macOS. Window › Zoom gets a context (_x), because on macOS it means filling the screen.How to test this
Platforms: both macOS and Windows, because each has its own set of items. Build: the Buildkite artifact for the current head commit, or a local run from the repository root as described below.
The journey
the app menu and the native file dialogs are translated in mainintests/e2e/journeys/i18n.spec.jswalks the whole application menu under en-XA. It fails if any item that is not a separator lacks the pseudo-locale brackets. On trunk it is red and lists 41 untranslated items. Run it from the repository root:That journey runs on the platform it is launched on, so it covers macOS and Windows in CI. It cannot show that the shortcuts and native items still behave the same, so check that by hand:
Starting state: any state. From the repository root, run
npm run build:once, thennpx electron . --lang=en-XA.[Úñðó~~], including Edit › Substitutions and Edit › Speech and their items on macOS.npx electron .with no--lang. Every item reads in plain English, with the same wording as on trunk.What must not have happened:
Risks and limitations
tests/unit/menu.test.cjspins the lists per platform, and Electron is pinned anyway (see AGENTS.md).Related
Fixes #657. Part of #622.
Design decisions and alternatives considered
app.nameis passed in, not imported.menu.jsstays free of Electron imports, as its header says, so main supplies the name the same way it supplies the click handlers. It is the same value Electron's own labels use: the package name in development and the product name when packaged._xonly for Zoom. "Close" and "Copy" share an msgid with the renderer and mean the same thing there. On macOS, Zoom in the Window menu means filling the screen, not zooming in, so translators need the context.toggleDevToolsentry for View and Help, as the Settings… item is shared.buildFromTemplatemakes a separateMenuItemfrom each entry.Review outcome (required — see AGENTS.md)
0 [fix here] · 0 [follow-up].
e3eeeb6, on head4835fbaand baseorigin/trunk4835fba. It checked every item, order, separator and label against Electron v43.6.0'smenu-item-roles.ts, checked that accelerators and actions still come from the role, checked that the translator comments and themsgctxtreach the .pot, and checked that the tests fail on the old code. Outcome: no findings across the five dimensions. Style notes: (1) only About, Hide and Quit have their exact wording pinned by a unit test; (2)appNamedefaults to'', so a future caller that leaves it out would get "About " on macOS (main.jsis the only caller and passes it). Both were left as they are.e3eeeb6.Implementation notes
lib/browser/api/menu-item-roles.tsatv43.6.0.menu-item.tsapplies the role's default label only when no label is given, and always applies the role's accelerator.tests/unit/menu.test.cjspins each menu's items per platform, the app-named and per-platform quit labels, and checks under the pseudo-locale that every label is bracketed. 4 of its 11 tests fail on trunk.Menu.getApplicationMenu().npm run lint: clean.npm test: 2093 pass, 0 fail, 2 skipped.npm run test:electron: 2094 pass, 0 fail, 1 skipped.npx playwright test --project=journeys tests/e2e/journeys/i18n.spec.js: 32 passed.npx playwright test --project=journeys tests/e2e/journeys/settings.spec.js, which opens Settings from the menu: 6 passed.Screenshots or recording
To add: the Edit and Window menus under
--lang=en-XA, on macOS and on Windows.🤖 Generated with Claude Code