Repository navigation
Add multilingual Java Pack UI with Simplified Chinese support - #1791
Conversation
Localize the manifest, extension-host messages and all eight webviews using VS Code's display language. Add Simplified Chinese catalogs and extraction/regression guards while preserving raw command, setting and telemetry values. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The localization test can pass when the bootstrap is missing because indexOf returns -1, leaving broken browser translations after restoration undetected.
1 open issue
What changed in this PR
Adds Simplified Chinese support for Java Pack’s own UI, addressing #1790 and establishing a localization workflow with English fallback.
Changes:
- Externalizes manifest captions, native messages, and webview text while preserving command identifiers and settings values.
- Adds shared localization initialization, escaped HTML handling, and reorderable rich-text placeholders.
- Adds catalog guards, regression tests, English/Chinese AutoTest scenarios, and contributor documentation.
| File | Description |
|---|---|
| tests/webview-localization.test.js | Tests bootstrap safety, fallback, display mappings, and restoration. |
| tests/project-settings.test.js | Updates localization mocks for project settings tests. |
| tests/localized-actions.test.js | Tests translated action routing and cancellation. |
| tests/localization.test.js | Tests catalog completeness and extraction guards. |
| tests/java-runtime.test.js | Updates runtime localization mocks. |
| tests/helpers/l10n.js | Adds a reusable translation mock. |
| test-plans/localization/zh-cn.yaml | Adds Chinese UI acceptance checks. |
| test-plans/localization/en-native.yaml | Adds English native-action and restoration checks. |
| test-plans/java-webview-migration.yaml | Expands English smoke coverage using stable commands. |
| src/welcome/index.ts | Localizes Help Center titles and bootstrap. |
| src/welcome/assets/index.ts | Initializes browser localization before rendering. |
| src/welcome/assets/components/TourPage.tsx | Localizes tour content while preserving telemetry names. |
| src/welcome/assets/components/SocialMediaPanel.tsx | Localizes link captions without changing targets. |
| src/welcome/assets/components/QuickActionPanel.tsx | Localizes quick actions with rich-text placeholders. |
| src/welcome/assets/components/NavigationPanel.tsx | Separates translated labels from action identities. |
| src/welcome/assets/components/Header.tsx | Localizes heading and blog-link text. |
| src/welcome/assets/components/ControllerPanel.tsx | Localizes the visibility checkbox label. |
| src/utils/index.ts | Uses object identity for the translated Install action. |
| src/recommendation/xml.ts | Localizes the XML extension recommendation. |
| src/providers/CodeActionProvider.ts | Localizes the classpath quick-fix caption. |
| src/project-settings/projectSettingsView.ts | Localizes project settings titles and bootstrap. |
| src/project-settings/handlers/CompilerRequestHandler.ts | Localizes the missing-extension notification. |
| src/project-settings/handlers/ClasspathRequestHandler.ts | Localizes dialogs, errors, and confirmation actions. |
| src/project-settings/assets/maven/features/MavenConfigurationView.tsx | Localizes the non-Maven project message. |
| src/project-settings/assets/maven/features/components/Profile.tsx | Localizes Maven profile labels. |
| src/project-settings/assets/mainpage/features/component/SideBar.tsx | Localizes navigation captions. |
| src/project-settings/assets/mainpage/features/component/ProjectSelector.tsx | Localizes the project selector label. |
| src/project-settings/assets/mainpage/features/component/Footer.tsx | Localizes apply-button states. |
| src/project-settings/assets/mainpage/features/component/Exception.tsx | Localizes exception messages with trusted links. |
| src/project-settings/assets/index.tsx | Initializes localization before rendering project settings. |
| src/project-settings/assets/compiler/features/components/Hint.tsx | Localizes build-file guidance. |
| src/project-settings/assets/compiler/features/CompilerConfigurationView.tsx | Localizes compiler controls and warnings. |
| src/project-settings/assets/classpath/features/components/UnmanagedFolderSources.tsx | Localizes unmanaged source controls. |
| src/project-settings/assets/classpath/features/components/Sources.tsx | Localizes source-path editing controls. |
| src/project-settings/assets/classpath/features/components/Output.tsx | Localizes output-path labels and tooltips. |
| src/project-settings/assets/classpath/features/components/Libraries.tsx | Localizes library controls and empty state. |
| src/project-settings/assets/classpath/features/components/JdkRuntime.tsx | Localizes JDK status and actions. |
| src/project-settings/assets/classpath/features/components/Hint.tsx | Localizes classpath persistence guidance. |
| src/project-settings/assets/classpath/features/ClasspathConfigurationView.tsx | Localizes classpath tab captions. |
| src/overview/assets/index.ts | Initializes Overview browser localization. |
| src/l10n/richText.tsx | Adds reorderable React-node placeholders. |
| src/l10n/host.ts | Adds escaped HTML and inert localization bootstrap helpers. |
| src/l10n/display.ts | Maps project types to translated display labels. |
| src/l10n/browser.ts | Initializes browser translations from the host bundle. |
| src/java-runtime/utils/upstreamApi.ts | Localizes upstream runtime warnings. |
| src/java-runtime/index.ts | Localizes legacy runtime titles, dialogs, and inventory errors. |
| src/java-runtime/assets/ToolingJDKPanel.tsx | Localizes tooling runtime information and actions. |
| src/java-runtime/assets/ProjectJDKPanel.tsx | Localizes project runtime information and labels. |
| src/java-runtime/assets/index.ts | Initializes legacy runtime browser localization. |
| src/java-runtime/assets/components/ProjectTypeHint.tsx | Localizes guidance while retaining build examples. |
| src/java-runtime/assets/components/JDKActions.tsx | Localizes JDK installation and location actions. |
| src/java-runtime/assets/components/DefaultJDKSelector.tsx | Localizes the Edit tooltip. |
| src/install-jdk/index.ts | Localizes installer titles and bootstrap. |
| src/install-jdk/assets/index.tsx | Initializes installer browser localization. |
| src/install-jdk/assets/features/InstallJDKView.tsx | Localizes installer tabs and reload guidance. |
| src/install-jdk/assets/features/components/OtherJDKsPanel.tsx | Compacts markup without changing product links. |
| src/install-jdk/assets/features/components/AdoptiumJDKPanel.tsx | Localizes download and version labels. |
| src/formatter-settings/utils.ts | Localizes diagnostics and download-retry actions. |
| src/formatter-settings/index.ts | Localizes formatter HTML and native dialogs. |
| src/formatter-settings/assets/labels.ts | Adds display mappings that preserve formatter values. |
| src/formatter-settings/assets/index.tsx | Initializes formatter browser localization. |
| src/formatter-settings/assets/features/formatterSettings/FormatterSettingView.tsx | Localizes formatter categories and read-only actions. |
| src/formatter-settings/assets/features/formatterSettings/components/Setting.tsx | Localizes setting labels and accessible names. |
| src/ext-guide/index.ts | Localizes guide HTML, descriptions, and buttons. |
| src/ext-guide/assets/index.ts | Localizes the selected-extension count. |
| src/daemon/index.ts | Localizes cache-recovery notification and action. |
| src/commands/handler.ts | Localizes recommendations, installation progress, and AWT messages. |
| src/beginner-tips/index.ts | Localizes beginner-page titles and bootstrap. |
| src/beginner-tips/assets/tabs/QuickStartPanel.tsx | Localizes quick-start guidance while retaining code samples. |
| src/beginner-tips/assets/tabs/FaqPanel.tsx | Localizes FAQ content with trusted links. |
| src/beginner-tips/assets/tabs/DebuggingPanel.tsx | Localizes debugging guidance and action labels. |
| src/beginner-tips/assets/tabs/CodeEditingPanel.tsx | Localizes editing guidance and shortcut labels. |
| src/beginner-tips/assets/index.tsx | Initializes beginner-page browser localization. |
| src/beginner-tips/assets/BeginnerTips.tsx | Localizes the page heading and tabs. |
| scripts/check-localization.js | Checks catalog invariants and extraction drift. |
| README.md | Links to the translation contributor guide. |
| package.nls.zh-cn.json | Adds Simplified Chinese manifest translations. |
| package.nls.json | Adds English manifest resource keys. |
| package.json | Registers catalogs, localized captions, tooling, and dependencies. |
| docs/localization.md | Documents localization conventions, validation, and release gates. |
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Independent Chinese-language review and installed validation of VS Code 1.74 compatibility, legacy Runtime restoration, and unsupported-locale fallback remain release gates requiring human qualification.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
|
I've published Please update AutoTest to 0.7.36 and:
The smoke-driver notification-toast limitation is unchanged; this update should not be counted as qualifying native toast coverage. Please also update the PR description/localization documentation once the localized AutoTest runs are passing. |
Promote English and Chinese scenarios into CI discovery, verify native locales and deterministic actions/restoration, and document installed-VSIX results. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the existing job-owned RUNNER_TEMP for the two macOS locale cases to avoid oversized VS Code Unix IPC socket paths. Preserve per-run isolation, all locale assertions, the OS matrix and failure propagation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve the npm latest release in discovery and retain validation plus exact shared-version installation in every test and aggregate job. Update guards and CI documentation without changing historical 0.7.36 qualification records. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Java Pack's own UI was English-only even when VS Code used a different display language. This adds Simplified Chinese support and establishes a native localization workflow for additional languages, with English as the source and fallback.
Approach
vscode.l10nin the extension host and bundled@vscode/l10nin all eight webview implementations, including the legacy Runtime serializer. Initialize browser localization before rendering through a shared escaped, nonce/CSP-preserving bootstrap using the bundle selected by VS Code. No pack-specific language setting or remote translation lookup.@vscjava/vscode-autotest@latestonce per workflow run, validate and publish the returned version, and install that exact discovered version in every test and aggregate job for run consistency. Jobs do not independently resolve latest. Promotelocalization-en.yamlandlocalization-zh-cn.yamlinto top-leveltest-plans/discovery, with corrected fixture paths, explicit native locales and the matching Chinese language pack. Both share an isolatedsetup.vscodeConfigenvironment. Nine additional Node guards cover shared latest-version resolution/installation, plan discovery, locale/configuration, deterministic assertions, setting effects, reload structure, CI failure propagation and the scoped macOS temporary-directory setup.Product names, user content, embedded walkthrough media, SVG/image content, release/tutorial prose and bundled extensions' translations are outside scope. The minimum VS Code version remains
^1.74.0; build routing, Node versions and permissions are unchanged. Both locale scenarios use the existing Windows/Linux/macOS CI matrix and retain nonzero failure exits; there is no localization soft-fail or manual-only exclusion.Validation
npm test: 115/115 passed in the recorded multilingual qualification.npm run l10n:check: passed catalog invariants and non-mutating extraction-drift checks.npm run build: passed with warnings.npx -y @vscode/vsce@latest package -o vscode-java-pack-localized.vsixproduced the qualified VSIX. The actual package audit passed all 45 manifest keys, 587 runtime messages, eight browser assets, unchanged link/icon/placeholder invariants and synthetic fallback;node_modulesis excluded.vscode.env.languagebefore steps:en/enzh-cn/zh-cnThese runs exercise the original Welcome tab, localized active titles and positive/wrong-language content on all seven currently routable pages, the translated Project Settings Command Palette caption, raw AWT settings, actual formatter checkbox setting effects, and a successful real window reload followed by restored Help Center title/content. Java examples and product names remain unchanged. The public
java.runtimeroute is Project Settings' JDK page, not the legacy Runtime implementation.Exact reproducible local locale execution commands, retaining the actually tested runner version:
Recorded results, deterministic evidence, logs and screenshots are saved under the two output directories above. Qualified VSIX SHA256:
C716CC0386C415889F5BF6955CE8ABFBA90A7424FA44C10A9F3A94E5058BE838. Earlier unsuccessful attempts returned exit 1, including real verifier failures; their evidence is retained separately.Cross-platform locale CI
At head
a58b49c82ae63cb2d9799716c97a6a3ec14272ea, all six locale jobs in E2E run 42578524630 passed actual installed-package execution against the branch-built VSIX, with AutoTest 0.7.36 and VS Code 1.145.2. Downloaded per-case reports confirm the pre-step actual native language, 31/31 steps, zero failures/errors/skips and successful real reload/restored-title/content checks in every case:enzh-cnThe earlier two macOS locale jobs at
692381fcrashed before the first window, locale probe or any scenario step. AutoTest's canonical default temp root produced a 109-character main IPC socket path, exceeding macOS's 103-character limit. The focused fix uses the existing job-ownedRUNNER_TEMPasTMPDIRonly for the two macOS locale cases; launch evidence now shows unique disposable profiles under that short root and 77-character recorded IPC paths. No runner installation, launch flag, assertion, plan step, OS-matrix entry or failure exit was changed. Documentation and a regression guard cover this setup. Normal CI and CodeQL succeeded at that corrected head. The broader E2E run includes failures in other scenarios and is not claimed globally green; their causes are not classified by this locale-only follow-up.The latest-review revision
1a1e9adda72a23f8a53c321a433c540ec52933e9restores dynamic latest discovery without changing the shared output or exact-version job installs.node --test tests\localization-plans.test.jspassed 9/9, including the updated discovery/install wiring and retained macOS/failure guards. The exact workflow Bash resolver was executed against npm and returned 0.7.36; its retained guard rejected empty, tag-only, incomplete, multiline and malformed version strings with exit 1. Since npm latest is still the actually qualified 0.7.36, the preceding six-job evidence is preserved as historical execution ata58b49c, not relabeled as a new run. No product source, locale plan or qualified VSIX was changed by this resolver-only follow-up. CI uses latest; the explicit 0.7.36 reproduction commands and historical results above intentionally retain the actual tested version.AutoTest's smoke driver still suppresses native notification toasts and formatter prompts. These automated runs verify saved action effects, not native toast/prompt UI. A separate earlier normal-GUI Chinese qualification on VS Code 1.145.0 observed Chinese chrome and all seven routable pages before/after reload; real AWT notifications and formatter No/Yes actions produced the expected settings/file effects. That is separate evidence, not smoke-driver toast coverage. GUI prompt dismissal returning
undefinedand Install JDK Other-tab switching remain unqualified.API compatibility was checked against genuine VS Code 1.74 declarations; this is not an installed 1.74 UI run. See
docs/localization.mdfor the supported locale/configuration workflow and remaining qualification boundaries.Remaining release gates
java.runtimecommand opens Project Settings instead.Fixes #1790