feat: add i18n support with Simplified Chinese (zh-cn) translations - #1038
Open
fangfuzha wants to merge 4 commits into
Open
feat: add i18n support with Simplified Chinese (zh-cn) translations#1038fangfuzha wants to merge 4 commits into
fangfuzha wants to merge 4 commits into
Conversation
Co-authored-by: traeagent <traeagent@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds VS Code extension i18n support for configuration strings by introducing default (English) and Simplified Chinese locale files, and wiring contributes.configuration strings in package.json to %key% placeholders so VS Code can render localized settings descriptions.
Changes:
- Added
package.nls.json(default English) containing all configuration title/description/enumDescription strings. - Added
package.nls.zh-cn.jsonproviding Simplified Chinese translations for the same keys. - Updated
package.jsonconfiguration metadata to reference%config.*%keys, and updated.vscodeignoreto include the new locale file in the VSIX.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| package.nls.json | Adds default English NLS strings for configuration UI. |
| package.nls.zh-cn.json | Adds zh-cn translations for configuration UI strings. |
| package.json | Replaces hardcoded configuration strings with NLS %key% placeholders. |
| .vscodeignore | Ensures locale files are packaged into the extension VSIX. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+15
to
+16
| "config.formatter.spacesBeforeEndOfLineComment.enumDescriptions.1": "行尾注释前留 1 个空格 # 像这样。", | ||
| "config.formatter.spacesBeforeEndOfLineComment.enumDescriptions.2": "行尾注释前留 2 个空格 # 像这样。", |
Comment on lines
+10
to
+11
| !package.nls.json | ||
| !package.nls.zh-cn.json |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Use NBSP (U+00A0) in enum description examples to preserve visual spacing of spaces before '#' in VS Code Settings UI (both en and zh-cn) - Replace per-locale whitelist in .vscodeignore with package.nls*.json wildcard pattern for future-proofing
Localize all remaining user-visible strings in package.json: - customEditors: displayName (1 string) - commands: category + 27 command titles (28 strings) - debuggers: label, launch/attach config descriptions, enum descriptions, initialConfigurations name, configurationSnippets labels and descriptions (30 strings) - viewsContainers: title (1 string) - views: 3 view names - viewsWelcome: 3 welcome contents Total: 90 localized strings (up from 24). English (package.nls.json) and Simplified Chinese (package.nls.zh-cn.json) are fully in sync. No functional code changes.
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
Add internationalization (i18n) support for the extension's configuration settings, with Simplified Chinese (zh-cn) as the first localized language.
Changes
package.nls.json(new): Default English locale file containing all 24 configuration string keys (title, descriptions, enum descriptions).package.nls.zh-cn.json(new): Simplified Chinese translation file with all 24 keys fully translated.package.json: Replaced all hardcoded English description strings incontributes.configurationwith%key%placeholder references..vscodeignore: Added!package.nls.zh-cn.jsonto ensure the Chinese locale file is included in the packaged vsix.Scope
This PR is focused solely on i18n infrastructure and Chinese translations — no functional code changes, no TypeScript modifications, no behavior changes.
How it works
VS Code automatically loads the appropriate
package.nls.<locale>.jsonbased on the user's display language. Whenlocaleiszh-cn, all configuration settings descriptions will appear in Chinese; for any other locale, it falls back to the default English strings inpackage.nls.json.