add localization for extension#3834
Conversation
There was a problem hiding this comment.
Pull request overview
Adds localization support for the VS Code native-preview extension by introducing package/runtime localization files and replacing many user-facing strings with localized equivalents.
Changes:
- Adds
package.nls.jsonand runtimel10n/bundle.l10n.json. - Updates
package.jsonmetadata/configuration strings to use NLS keys and declares anl10nfolder. - Wraps many extension UI messages, quick-pick labels, status text, and errors with
vscode.l10n.t.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
_extension/package.json |
Enables extension localization and localizes selected manifest metadata/configuration strings. |
_extension/package.nls.json |
Adds package manifest localization keys. |
_extension/l10n/bundle.l10n.json |
Adds runtime localization bundle entries for vscode.l10n.t strings. |
_extension/src/client.ts |
Localizes language client messages and restart/crash UI text. |
_extension/src/commands.ts |
Localizes a command argument error message. |
_extension/src/extension.ts |
Localizes activation/configuration warning and output messages. |
_extension/src/languageFeatures/sourceDefinition.ts |
Localizes source-definition command messages. |
_extension/src/projectStatus.ts |
Localizes project status UI strings. |
_extension/src/session.ts |
Localizes session commands, profiling messages, version selection, and prompts. |
| label: "$(refresh) " + vscode.l10n.t("Restart Server"), | ||
| description: vscode.l10n.t("Restart the TypeScript Native Preview language server"), |
There was a problem hiding this comment.
I don't think prepending the icon is appropriate - it won't work well for right-to-left languages.
I think ideally you should place the $() placeholders in the string itself.
| label: "$(refresh) " + vscode.l10n.t("Restart Server"), | |
| description: vscode.l10n.t("Restart the TypeScript Native Preview language server"), | |
| label: vscode.l10n.t("$(refresh) Restart Server"), | |
| description: vscode.l10n.t("Restart the TypeScript Native Preview language server"), |
and the same for the strings below.
I do see some instances in the VSCode codebase where some strings use vscode.l10n.t("{0} Do action", "$(icon)"), but I don't think that's necessary.
There was a problem hiding this comment.
I think it's helpful for testing on this PR, but I'd say it's better not to check this in and add an entry to scripts to generate this on the fly.
DanielRosenwasser
left a comment
There was a problem hiding this comment.
I think you'll need to modify the statusBar.ts too.
I don't know if text in the output channel need to be localized. I'm leaning against that right now.
| commands.push({ label: "", kind: vscode.QuickPickItemKind.Separator }); | ||
| if (exe) { | ||
| commands.push({ | ||
| label: `Executable`, |
There was a problem hiding this comment.
This, PID, and "manage workspace trust..." need to be localized
fixes #3719
Previously,
The localizations can be tested by switching your language (
ctrl + shift + P,Configure Display Language) toqps-ploc. (qps-plocgenerated bynpx @vscode/l10n-dev generate-pseudo -o ./l10n/ ./l10n/bundle.l10n.json ./package.nls.json)