Skip to content

Commit 00e5b15

Browse files
Merge pull request #809 from Microsoft/localizedServices
Update compiler localized messages with those provided by the language s...
2 parents db9ad6d + a14e46a commit 00e5b15

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

src/compiler/core.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,9 @@ module ts {
209209
export var localizedDiagnosticMessages: Map<string> = undefined;
210210

211211
export function getLocaleSpecificMessage(message: string) {
212-
if (ts.localizedDiagnosticMessages) {
213-
message = localizedDiagnosticMessages[message];
214-
}
215-
216-
return message;
212+
return localizedDiagnosticMessages && localizedDiagnosticMessages[message]
213+
? localizedDiagnosticMessages[message]
214+
: message;
217215
}
218216

219217
export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic;

src/services/core/diagnosticCore.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
///<reference path='references.ts' />
22

33
module TypeScript {
4-
export var LocalizedDiagnosticMessages: ts.Map<any> = null;
5-
64
export class Location {
75
private _fileName: string;
86
private _lineMap: LineMap;

src/services/services.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,8 +1650,8 @@ module ts {
16501650
var writer: (filename: string, data: string, writeByteOrderMark: boolean) => void = undefined;
16511651

16521652
// Check if the localized messages json is set, otherwise query the host for it
1653-
if (!TypeScript.LocalizedDiagnosticMessages) {
1654-
TypeScript.LocalizedDiagnosticMessages = host.getLocalizedDiagnosticMessages();
1653+
if (!localizedDiagnosticMessages) {
1654+
localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages();
16551655
}
16561656

16571657
function getSourceFile(filename: string): SourceFile {

src/services/shims.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ module ts {
369369
if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") {
370370
return null;
371371
}
372+
372373
try {
373374
return JSON.parse(diagnosticMessagesJson);
374375
}

0 commit comments

Comments
 (0)