Repository navigation
Add Simplified Chinese (zh-cn) localization - #650
Open
Hengqian Ling (linghengqian) wants to merge 4 commits into
Open
Hengqian Ling (linghengqian) wants to merge 4 commits into
Hengqian Ling (linghengqian) wants to merge 4 commits into
Conversation
Fixes microsoft#648 Add the zh-cn translations of the manifest (package.nls.zh-cn.json) and of the runtime strings (l10n/bundle.l10n.zh-cn.json), and set "l10n" in package.json so VS Code loads them. scripts/l10n.mjs, built on @vscode/l10n-dev, regenerates the English template l10n/bundle.l10n.json from the extension, the workspace packages it bundles, and the dependencies that ship their own bundle. lint now also runs `lint:l10n`, which fails when the template is out of date or when a translation would break the UI (a lost placeholder, link, code span, line break or surrounding space). Localize the strings that were still literals: button labels, walkthrough alt texts, displayName/description/settings title, the default labels of the command template settings, Error messages, and the filter prompts. The Compose language service runs in its own process, so the extension sends it the translations in initializationOptions.l10nBundle and it uses @vscode/l10n.
Hengqian Ling (linghengqian)
force-pushed
the
feat/zh-cn-localization
branch
from
November 5, 2026 05:11
e3c1b3d to
04d5e7b
Compare
lint:l10n only compared {0}-style placeholders, so a translation could drop
the "$" of ${workspaceFolder} or change the name in ${command:pickProcess}
and still pass. These variables are in the descriptions of the debug attach
properties and users copy them into launch.json, so compare them as a part
of their own.
Also coalesce the placeholder match to an empty array, like the other
parts, instead of relying on new Set(null).
Brandon Waterloo (bwateratmsft)
left a comment
Collaborator
There was a problem hiding this comment.
🤖 Inline translation feedback.
- Use a switch for the placeholder and title of the filter prompts, and regenerate the l10n template for the new string order. - zh-cn: name `compose down` instead of translating "take down" as "stop", and translate "out of date" and "outdated" as "not the latest version" instead of "expired". - Note in eslint.config.mjs when the local ignore of scripts/ can go.
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.
Summary
Fixes #648. Container Tools shipped no translations, so with a non-English display language everything the extension adds stayed in English. This adds Simplified Chinese (
zh-cn) and the tooling that keeps translations in step with the code. Other languages can be added the same way, seedocs/localization.md.package.nls.zh-cn.json(388 strings) andl10n/bundle.l10n.zh-cn.json(584 strings), and set"l10n": "./l10n"inpackage.json.scripts/l10n.mjs, built on@vscode/l10n-dev.pnpm --filter vscode-containers run l10nregenerates the English templatel10n/bundle.l10n.jsonfrom the extension, the workspace packages it bundles (includingvscode-docker-registries), and the dependencies that ship their own bundle. The@microsoft/vscode-azext-*libraries are in that last group: they are bundled into the extension, and VS Code looks up theirvscode.l10n.tcalls in the extension's bundle.lint:l10nas part oflint. It fails when the template is out of date, or when a translation would break the UI: a lost{0}placeholder, a changedcommand:link or code span, or different line breaks or surrounding spaces. Missing or stale translations are only reported, because VS Code falls back to English.altTexts,displayName,descriptionand the settings title, the defaultlabelof thecontainers.commands.*settings, and theErrormessages. The filter prompts now use whole sentences per tree instead of splicingcontainersorimagesinto one.vscode.l10n.bundleininitializationOptions.l10nBundleand the server uses@vscode/l10n. Hover texts, code lenses and completion details are covered.zh-cnterminology indocs/localization.mdandCONTRIBUTING.md.The English text is unchanged. Not covered: the Dockerfile language server (a third-party package with hard-coded English messages), the diagnostics of the Compose language service (they come from the
yamllibrary), and the errors ofvscode-container-clientandvscode-processutils, which don't depend onvscode.Validation
pnpm lintandpnpm build.xvfb-run -a pnpm exec vscode-test --skip-extension-dependencies(the flag only matters on WSL, wherebin/codewaits for a prompt).pnpm --filter vscode-containers run package: the Marketplace manifest keeps the EnglishdisplayNameanddescription, the localization files are in the VSIX, andscripts/is not.lint:l10nalso passes on Node 22.18, the version in.nvmrc.Manual UI checks
Checked in an Extension Development Host (VS Code 1.145) with the Chinese (Simplified) Language Pack:
labelofcontainers.commands.composeLogs.services:and each service, and the hover text of keys such asimage, are translated. That covers the language server process.@microsoft/vscode-azext-utilsis translated:(Press 'Space' to select and 'Enter' to confirm), shown by Compose Up - Select Services.To check it yourself, install the language pack, run Configure Display Language, and start the Run Extension launch configuration.
Notes for reviewers
docs/localization.md, so it is easy to change in one pass.lint:l10nalso fails when updating a@microsoft/vscode-azext-*library adds strings, untilpnpm run l10nis run. It can be dropped without affecting the translations.Errormessages are localized too, so they reach telemetry in the user's language. The reasons given toUserCancelledErrorare left alone, because they are telemetry values.@vscode/l10nis a new runtime dependency of the Compose language server bundle (MIT, no dependencies of its own), soNOTICE.htmlneeds regenerating the usual way.NOTICE.htmland the changelog are not touched here.@vscode/l10n-devis a devDependency and adds 26 dev-only packages to the lockfile.