Support --locale with --build

Fixes #31960
This commit is contained in:
Sheetal Nandi 2019-06-19 15:02:00 -07:00
parent dbabc1241c
commit 06d188a255
4 changed files with 22 additions and 7 deletions

View file

@ -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<Diagnostic>;
errors: Diagnostic[];
}
/*@internal*/

View file

@ -172,6 +172,7 @@ namespace ts {
traceResolution?: boolean;
/* @internal */ diagnostics?: boolean;
/* @internal */ extendedDiagnostics?: boolean;
/* @internal */ locale?: string;
[option: string]: CompilerOptionsValue | undefined;
}

View file

@ -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"],

View file

@ -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);