Skip to content

Commit

Permalink
Adopt l10n for grunt and php-language-features (#165552)
Browse files Browse the repository at this point in the history
* Adopt l10n for grunt

For #164438

* Adopt l10n for php-language-features

For #164438
  • Loading branch information
mjbvz committed Nov 4, 2022
1 parent 4001e9d commit ac26690
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 26 deletions.
4 changes: 1 addition & 3 deletions extensions/grunt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
8 changes: 3 additions & 5 deletions extensions/grunt/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);
});
}
Expand Down Expand Up @@ -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;
}
Expand Down
5 changes: 0 additions & 5 deletions extensions/grunt/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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==
1 change: 0 additions & 1 deletion extensions/php-language-features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
"watch": "npx gulp watch-extension:php-language-features"
},
"dependencies": {
"vscode-nls": "^5.2.0",
"which": "^2.0.2"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -179,7 +177,7 @@ export default class PHPValidationProvider {
return new Promise<void>(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;
Expand Down Expand Up @@ -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;
Expand All @@ -269,7 +267,7 @@ export default class PHPValidationProvider {
}

private async showErrorMessage(message: string): Promise<void> {
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);
}
Expand Down
5 changes: 0 additions & 5 deletions extensions/php-language-features/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ac26690

Please sign in to comment.