Skip to content

Add multilingual Java Pack UI with Simplified Chinese support - #1791

Merged
Changyong Gong (chagong) merged 5 commits into
mainfrom
chagong-java-pack-multilingual-ui
Nov 9, 2026
Merged

Changyong Gong (chagong) merged 5 commits into
mainfrom
chagong-java-pack-multilingual-ui

Conversation

@chagong

@chagong Changyong Gong (chagong) commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Externalize pack-owned manifest text into matching 45-key English/Chinese catalogs and add matching 587-message extension-host/webview catalogs.
  • Use native vscode.l10n in the extension host and bundled @vscode/l10n in 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.
  • Preserve typed native action routing and cancellation, command/protocol identifiers, settings values, Java examples and formatter XML. Localize display mappings lazily and use reorderable trusted-node placeholders for rich text.
  • Add catalog/extraction-drift guards, translated-action/fallback/bootstrap/restoration regressions and contributor localization documentation.
  • Resolve npm's @vscjava/vscode-autotest@latest once 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. Promote localization-en.yaml and localization-zh-cn.yaml into top-level test-plans/ discovery, with corrected fixture paths, explicit native locales and the matching Chinese language pack. Both share an isolated setup.vscodeConfig environment. 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.vsix produced 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_modules is excluded.
  • Both promoted plans validated with the published AutoTest 0.7.36 and then actually executed again against that packaged VSIX on Windows, VS Code 1.145.2, in owned disposable profiles/copy workspaces. The runner verified vscode.env.language before steps:
Scenario Requested / actual native language Passed Failures / errors / skips
English en / en 31/31 0 / 0 / 0
Simplified Chinese zh-cn / zh-cn 31/31 0 / 0 / 0

These 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.runtime route is Project Settings' JDK page, not the legacy Runtime implementation.

Exact reproducible local locale execution commands, retaining the actually tested runner version:

npx -y @vscjava/vscode-autotest@0.7.36 run test-plans\localization-en.yaml --vsix vscode-java-pack-localized.vsix --no-llm --analysis-mode evidence-only --output test-results\localization-en --logs
npx -y @vscjava/vscode-autotest@0.7.36 run test-plans\localization-zh-cn.yaml --vsix vscode-java-pack-localized.vsix --no-llm --analysis-mode evidence-only --output test-results\localization-zh-cn --logs

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:

CI platform English, requested/actual en Chinese, requested/actual zh-cn
Windows 31/31 passed 31/31 passed
Ubuntu 31/31 passed 31/31 passed
macOS 31/31 passed 31/31 passed

The earlier two macOS locale jobs at 692381f crashed 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-owned RUNNER_TEMP as TMPDIR only 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 1a1e9adda72a23f8a53c321a433c540ec52933e9 restores dynamic latest discovery without changing the shared output or exact-version job installs. node --test tests\localization-plans.test.js passed 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 at a58b49c, 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 undefined and 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.md for the supported locale/configuration workflow and remaining qualification boundaries.

Remaining release gates

  • Independent human Chinese-language review. The complete Chinese catalog is a draft translation, not independently reviewed.
  • Installed legacy Runtime restoration using a genuine previously saved legacy tab. The current public java.runtime command opens Project Settings instead.
  • Installed fallback under a genuinely non-English locale not shipped by Java Pack. Synthetic missing-key/bundle checks do not establish this installed behavior.
  • Installed VS Code 1.74 behavior with compatible dependency extensions.

Fixes #1790

image image

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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread tests/webview-localization.test.js Resolved
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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

@wenytang-ms

Copy link
Copy Markdown
Contributor

I've published @vscjava/vscode-autotest 0.7.36 with opt-in shared JSON environment configuration (setup.vscodeConfig / --vscode-config) and working display-language selection (setup.locale / --locale). The runner validates the actual vscode.env.language before executing steps. A real Chinese VS Code smoke plan passed, verifying user/workspace settings and the Chinese Welcome tab. Release: https://github.com/wenytang-ms/javaext-autotest/releases/tag/v0.7.36

Please update AutoTest to 0.7.36 and:

  1. Move the English and Chinese localization YAML plans from test-plans/localization/ into the top-level test-plans/ directory so the existing CI discovery includes them; adjust their relative fixture/config paths accordingly.
  2. Explicitly configure en / zh-cn, keep the matching Chinese language pack installed, and run both plans against this PR's packaged VSIX. Please provide actual execution results, not just YAML validation.
  3. Include these cases in CI with deterministic assertions for localized titles/content, untranslated-text regressions, actions, and reload/restoration. Failures must fail CI so these tests guard future UI/localization changes rather than remain manual acceptance scenarios.

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>
Comment thread .github/workflows/e2e-autotest.yml Resolved
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>
@chagong
Changyong Gong (chagong) merged commit 1898fa2 into main Nov 9, 2026
88 of 91 checks passed
@chagong
Changyong Gong (chagong) deleted the chagong-java-pack-multilingual-ui branch November 9, 2026 08:59
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.

Support Simplified Chinese localization for the pack's own UI

3 participants