diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 394a94cb663..c0363788c9e 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -147,6 +147,12 @@ namespace ts { category: Diagnostics.Basic_Options, description: Diagnostics.Enable_incremental_compilation, }, + { + name: "locale", + type: "string", + category: Diagnostics.Advanced_Options, + description: Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us + }, ]; /* @internal */ @@ -698,12 +704,6 @@ namespace ts { category: Diagnostics.Advanced_Options, description: Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files }, - { - name: "locale", - type: "string", - category: Diagnostics.Advanced_Options, - description: Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us - }, { name: "newLine", type: createMapFromTemplate({ @@ -1171,7 +1171,7 @@ namespace ts { export interface ParsedBuildCommand { buildOptions: BuildOptions; projects: string[]; - errors: ReadonlyArray; + errors: Diagnostic[]; } /*@internal*/ diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 94718a1b368..4602c0793be 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -172,6 +172,7 @@ namespace ts { traceResolution?: boolean; /* @internal */ diagnostics?: boolean; /* @internal */ extendedDiagnostics?: boolean; + /* @internal */ locale?: string; [option: string]: CompilerOptionsValue | undefined; } diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 3c033d658ef..3d1001c7daf 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -486,6 +486,16 @@ namespace ts { }); }); + it("parse build with --locale en-us", () => { + // --lib es6 0.ts + assertParseResult(["--locale", "en-us", "src"], + { + errors: [], + projects: ["src"], + buildOptions: { locale: "en-us" } + }); + }); + it("parse build with --tsBuildInfoFile", () => { // --lib es6 0.ts assertParseResult(["--tsBuildInfoFile", "build.tsbuildinfo", "tests"], diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index 6a340109238..d27c1aace4e 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -186,6 +186,10 @@ namespace ts { // Update to pretty if host supports it updateReportDiagnostic(buildOptions); + if (buildOptions.locale) { + validateLocaleAndSetLanguage(buildOptions.locale, sys, errors); + } + if (errors.length > 0) { errors.forEach(reportDiagnostic); return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);