Update compiler localized messages with those provided by the language service.

This commit is contained in:
Cyrus Najmabadi
2014-10-02 17:58:05 -07:00
parent db9ad6d1e5
commit a14e46a5e7
4 changed files with 6 additions and 9 deletions
+3 -5
View File
@@ -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;
-2
View File
@@ -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;
+2 -2
View File
@@ -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 {
+1
View File
@@ -369,6 +369,7 @@ module ts {
if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") {
return null;
}
try {
return JSON.parse(diagnosticMessagesJson);
}