Skip to content

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

Open
Changyong Gong (chagong) wants to merge 2 commits into
mainfrom
chagong-java-pack-multilingual-ui
Open

Changyong Gong (chagong) wants to merge 2 commits into
mainfrom
chagong-java-pack-multilingual-ui

Conversation

@chagong

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 legacy Runtime restoration. 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, English and Chinese AutoTest plans, and contributor localization documentation.

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; CI routing, Node versions and permissions are unchanged.

Validation

  • npm test: 106/106 passed.
  • npm run l10n:check: passed catalog invariants and non-mutating extraction-drift checks.
  • npm run build: passed with warnings. The actual packaged VSIX passed catalog, browser-asset, link/icon/placeholder and synthetic-fallback audits.
  • English installed AutoTest: 37/37 webview steps and 11/11 walkthrough/native/restoration steps passed on VS Code 1.145.1.
  • Chinese normal GUI: confirmed actual Chinese native chrome in an isolated existing VS Code 1.145.0 profile. Observed the walkthrough and representative localized content on all seven currently routable pages before and after a real window reload. Real AWT notifications and formatter No/Yes actions produced the expected settings/file effects; created formatter XML remained byte-identical to the packaged default after reload.
  • API compatibility checked against genuine VS Code 1.74 declarations. This is not an installed 1.74 UI run.

The Chinese AutoTest plan validates, but the runner's locale/attach forwarding did not launch Chinese. Chinese GUI observations above come from a separate supported normal-GUI attempt, not a passing Chinese AutoTest run. GUI prompt dismissal returning undefined and Install JDK Other-tab switching were not qualified.

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. Only the Chinese display-language pack was available; no additional installation or sign-in was performed.
  • Installed VS Code 1.74 behavior with compatible dependency extensions. No approved 1.74 installation was available.

Fixes #1790

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

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

2 participants