Skip to content

add localization for extension#3834

Open
iisaduan wants to merge 6 commits into
microsoft:mainfrom
iisaduan:localize-l10n
Open

add localization for extension#3834
iisaduan wants to merge 6 commits into
microsoft:mainfrom
iisaduan:localize-l10n

Conversation

@iisaduan
Copy link
Copy Markdown
Member

@iisaduan iisaduan commented May 13, 2026

fixes #3719

Previously,

The localizations can be tested by switching your language (ctrl + shift + P, Configure Display Language) to qps-ploc. (qps-ploc generated by npx @vscode/l10n-dev generate-pseudo -o ./l10n/ ./l10n/bundle.l10n.json ./package.nls.json)

Copilot AI review requested due to automatic review settings May 13, 2026 21:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.json and runtime l10n/bundle.l10n.json.
  • Updates package.json metadata/configuration strings to use NLS keys and declares an l10n folder.
  • 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.

Comment thread _extension/package.json
Comment thread _extension/src/client.ts Outdated
Comment thread _extension/package.nls.json Outdated
Comment thread _extension/package.nls.json Outdated
Comment thread _extension/src/session.ts
Comment thread _extension/src/session.ts
Comment thread _extension/package.nls.json Outdated
Comment thread _extension/src/session.ts
Comment on lines +272 to +273
label: "$(refresh) " + vscode.l10n.t("Restart Server"),
description: vscode.l10n.t("Restart the TypeScript Native Preview language server"),
Copy link
Copy Markdown
Member

@DanielRosenwasser DanielRosenwasser May 14, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

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

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.

Comment thread _extension/src/session.ts
commands.push({ label: "", kind: vscode.QuickPickItemKind.Separator });
if (exe) {
commands.push({
label: `Executable`,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This, PID, and "manage workspace trust..." need to be localized

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 localized user-facing strings in VS Code extension

3 participants