mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Update compiler localized messages with those provided by the language service.
This commit is contained in:
@@ -209,11 +209,9 @@ module ts {
|
||||
export var localizedDiagnosticMessages: Map<string> = undefined;
|
||||
|
||||
export function getLocaleSpecificMessage(message: string) {
|
||||
if (ts.localizedDiagnosticMessages) {
|
||||
message = localizedDiagnosticMessages[message];
|
||||
}
|
||||
|
||||
return message;
|
||||
return localizedDiagnosticMessages && localizedDiagnosticMessages[message]
|
||||
? localizedDiagnosticMessages[message]
|
||||
: message;
|
||||
}
|
||||
|
||||
export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
///<reference path='references.ts' />
|
||||
|
||||
module TypeScript {
|
||||
export var LocalizedDiagnosticMessages: ts.Map<any> = null;
|
||||
|
||||
export class Location {
|
||||
private _fileName: string;
|
||||
private _lineMap: LineMap;
|
||||
|
||||
@@ -1650,8 +1650,8 @@ module ts {
|
||||
var writer: (filename: string, data: string, writeByteOrderMark: boolean) => void = undefined;
|
||||
|
||||
// Check if the localized messages json is set, otherwise query the host for it
|
||||
if (!TypeScript.LocalizedDiagnosticMessages) {
|
||||
TypeScript.LocalizedDiagnosticMessages = host.getLocalizedDiagnosticMessages();
|
||||
if (!localizedDiagnosticMessages) {
|
||||
localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages();
|
||||
}
|
||||
|
||||
function getSourceFile(filename: string): SourceFile {
|
||||
|
||||
@@ -369,6 +369,7 @@ module ts {
|
||||
if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return JSON.parse(diagnosticMessagesJson);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user