From ac26690ed80cabe8c4face379d7df1493f9fc069 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 4 Nov 2022 13:50:21 -0700 Subject: [PATCH] Adopt l10n for grunt and php-language-features (#165552) * Adopt l10n for grunt For #164438 * Adopt l10n for php-language-features For #164438 --- extensions/grunt/package.json | 4 +--- extensions/grunt/src/main.ts | 8 +++----- extensions/grunt/yarn.lock | 5 ----- extensions/php-language-features/package.json | 1 - .../src/features/validationProvider.ts | 12 +++++------- extensions/php-language-features/yarn.lock | 5 ----- 6 files changed, 9 insertions(+), 26 deletions(-) diff --git a/extensions/grunt/package.json b/extensions/grunt/package.json index 0f5e605bcf993..35fc30eaba1e8 100644 --- a/extensions/grunt/package.json +++ b/extensions/grunt/package.json @@ -16,9 +16,7 @@ "compile": "gulp compile-extension:grunt", "watch": "gulp watch-extension:grunt" }, - "dependencies": { - "vscode-nls": "^5.2.0" - }, + "dependencies": {}, "devDependencies": { "@types/node": "16.x" }, diff --git a/extensions/grunt/src/main.ts b/extensions/grunt/src/main.ts index c213f1c69c990..886e7e27e716e 100644 --- a/extensions/grunt/src/main.ts +++ b/extensions/grunt/src/main.ts @@ -7,8 +7,6 @@ import * as path from 'path'; import * as fs from 'fs'; import * as cp from 'child_process'; import * as vscode from 'vscode'; -import * as nls from 'vscode-nls'; -const localize = nls.loadMessageBundle(); type AutoDetect = 'on' | 'off'; @@ -60,8 +58,8 @@ function getOutputChannel(): vscode.OutputChannel { } function showError() { - vscode.window.showWarningMessage(localize('gruntTaskDetectError', 'Problem finding grunt tasks. See the output for more information.'), - localize('gruntShowOutput', 'Go to output')).then(() => { + vscode.window.showWarningMessage(vscode.l10n.t("Problem finding grunt tasks. See the output for more information."), + vscode.l10n.t("Go to output")).then(() => { getOutputChannel().show(true); }); } @@ -215,7 +213,7 @@ class FolderDetector { if (err.stdout) { channel.appendLine(err.stdout); } - channel.appendLine(localize('execFailed', 'Auto detecting Grunt for folder {0} failed with error: {1}', this.workspaceFolder.name, err.error ? err.error.toString() : 'unknown')); + channel.appendLine(vscode.l10n.t("Auto detecting Grunt for folder {0} failed with error: {1}', this.workspaceFolder.name, err.error ? err.error.toString() : 'unknown")); showError(); return emptyTasks; } diff --git a/extensions/grunt/yarn.lock b/extensions/grunt/yarn.lock index 8b8c7a6c15b1e..e724e7fffa317 100644 --- a/extensions/grunt/yarn.lock +++ b/extensions/grunt/yarn.lock @@ -6,8 +6,3 @@ version "16.11.6" resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.6.tgz#6bef7a2a0ad684cf6e90fcfe31cecabd9ce0a3ae" integrity sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w== - -vscode-nls@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.2.0.tgz#3cb6893dd9bd695244d8a024bdf746eea665cc3f" - integrity sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng== diff --git a/extensions/php-language-features/package.json b/extensions/php-language-features/package.json index dd7f6445d1ae5..8f9723197b299 100644 --- a/extensions/php-language-features/package.json +++ b/extensions/php-language-features/package.json @@ -74,7 +74,6 @@ "watch": "npx gulp watch-extension:php-language-features" }, "dependencies": { - "vscode-nls": "^5.2.0", "which": "^2.0.2" }, "devDependencies": { diff --git a/extensions/php-language-features/src/features/validationProvider.ts b/extensions/php-language-features/src/features/validationProvider.ts index b50e2e8e779b1..d1f27e4a37e03 100644 --- a/extensions/php-language-features/src/features/validationProvider.ts +++ b/extensions/php-language-features/src/features/validationProvider.ts @@ -9,8 +9,6 @@ import * as which from 'which'; import * as path from 'path'; import * as vscode from 'vscode'; import { ThrottledDelayer } from './utils/async'; -import * as nls from 'vscode-nls'; -const localize = nls.loadMessageBundle(); const enum Setting { Run = 'php.validate.run', @@ -179,7 +177,7 @@ export default class PHPValidationProvider { return new Promise(resolve => { const executable = this.config!.executable; if (!executable) { - this.showErrorMessage(localize('noPhp', 'Cannot validate since a PHP installation could not be found. Use the setting \'php.validate.executablePath\' to configure the PHP executable.')); + this.showErrorMessage(vscode.l10n.t("Cannot validate since a PHP installation could not be found. Use the setting 'php.validate.executablePath' to configure the PHP executable.")); this.pauseValidation = true; resolve(); return; @@ -254,12 +252,12 @@ export default class PHPValidationProvider { let message: string | null = null; if (error.code === 'ENOENT') { if (this.config!.executable) { - message = localize('wrongExecutable', 'Cannot validate since {0} is not a valid php executable. Use the setting \'php.validate.executablePath\' to configure the PHP executable.', executable); + message = vscode.l10n.t("Cannot validate since {0} is not a valid php executable. Use the setting 'php.validate.executablePath' to configure the PHP executable.", executable); } else { - message = localize('noExecutable', 'Cannot validate since no PHP executable is set. Use the setting \'php.validate.executablePath\' to configure the PHP executable.'); + message = vscode.l10n.t("Cannot validate since no PHP executable is set. Use the setting 'php.validate.executablePath' to configure the PHP executable."); } } else { - message = error.message ? error.message : localize('unknownReason', 'Failed to run php using path: {0}. Reason is unknown.', executable); + message = error.message ? error.message : vscode.l10n.t("Failed to run php using path: {0}. Reason is unknown.", executable); } if (!message) { return; @@ -269,7 +267,7 @@ export default class PHPValidationProvider { } private async showErrorMessage(message: string): Promise { - const openSettings = localize('goToSetting', 'Open Settings'); + const openSettings = vscode.l10n.t("Open Settings"); if (await vscode.window.showInformationMessage(message, openSettings) === openSettings) { vscode.commands.executeCommand('workbench.action.openSettings', Setting.ExecutablePath); } diff --git a/extensions/php-language-features/yarn.lock b/extensions/php-language-features/yarn.lock index baafbeb7ca3ca..a418ca9f82329 100644 --- a/extensions/php-language-features/yarn.lock +++ b/extensions/php-language-features/yarn.lock @@ -17,11 +17,6 @@ isexe@^2.0.0: resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= -vscode-nls@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.2.0.tgz#3cb6893dd9bd695244d8a024bdf746eea665cc3f" - integrity sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng== - which@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"