Localize TS extension
This commit is contained in:
parent
27b12afea4
commit
6270510ef3
|
@ -11,7 +11,8 @@
|
|||
"vscode": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-extension-telemetry": "^0.0.4"
|
||||
"vscode-extension-telemetry": "^0.0.4",
|
||||
"vscode-nls": "^1.0.4"
|
||||
},
|
||||
"scripts": {
|
||||
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:typescript ./src/tsconfig.json"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* ------------------------------------------------------------------------------------------ */
|
||||
'use strict';
|
||||
|
||||
import { languages, commands, workspace, window, Uri, ExtensionContext, IndentAction, Diagnostic, DiagnosticCollection, Range } from 'vscode';
|
||||
import { env, languages, commands, workspace, window, Uri, ExtensionContext, IndentAction, Diagnostic, DiagnosticCollection, Range } from 'vscode';
|
||||
|
||||
import * as Proto from './protocol';
|
||||
import TypeScriptServiceClient from './typescriptServiceClient';
|
||||
|
@ -31,7 +31,10 @@ import WorkspaceSymbolProvider from './features/workspaceSymbolProvider';
|
|||
|
||||
import * as VersionStatus from './utils/versionStatus';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
export function activate(context: ExtensionContext): void {
|
||||
nls.config({locale: env.language});
|
||||
|
||||
let MODE_ID_TS = 'typescript';
|
||||
let MODE_ID_TSX = 'typescriptreact';
|
||||
|
|
|
@ -20,6 +20,9 @@ import * as VersionStatus from './utils/versionStatus';
|
|||
|
||||
import TelemetryReporter from 'vscode-extension-telemetry';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
let localize = nls.loadMessageBundle();
|
||||
|
||||
interface CallbackItem {
|
||||
c: (value: any) => void;
|
||||
e: (err: any) => void;
|
||||
|
@ -157,7 +160,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
|||
}
|
||||
|
||||
if (!fs.existsSync(modulePath)) {
|
||||
window.showErrorMessage(`The path ${path.dirname(modulePath)} doesn't point to a valid tsserver install. TypeScript language features will be disabled.`);
|
||||
window.showErrorMessage(localize('noServerFound', 'The path {0} doesn\'t point to a valid tsserver install. TypeScript language features will be disabled.', path.dirname(modulePath)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -180,7 +183,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
|||
electron.fork(modulePath, [], options, (err: any, childProcess: cp.ChildProcess) => {
|
||||
if (err) {
|
||||
this.lastError = err;
|
||||
window.showErrorMessage(`TypeScript language server couldn\'t be started. Error message is: ${err.message}`);
|
||||
window.showErrorMessage(localize('serverCouldNotBeStarted', 'TypeScript language server couldn\'t be started. Error message is: {0}'), err.message);
|
||||
this.logTelemetry('error', {message: err.message});
|
||||
return;
|
||||
}
|
||||
|
@ -249,10 +252,10 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
|||
let startService = true;
|
||||
if (this.numberRestarts > 5) {
|
||||
if (diff < 60 * 1000 /* 1 Minutes */) {
|
||||
window.showWarningMessage('The Typescript language service died unexpectedly 5 times in the last 5 Minutes. Please consider to open a bug report.');
|
||||
window.showWarningMessage(localize('serverDied','The Typescript language service died unexpectedly 5 times in the last 5 Minutes. Please consider to open a bug report.'));
|
||||
} else if (diff < 2 * 1000 /* 2 seconds */) {
|
||||
startService = false;
|
||||
window.showErrorMessage('The Typesrript language service died 5 times right after it got started. The service will not be restarted. Please open a bug report.');
|
||||
window.showErrorMessage(localize('serverDiedAfterStart', 'The Typesrript language service died 5 times right after it got started. The service will not be restarted. Please open a bug report.'));
|
||||
this.logTelemetry('serviceExited');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue