Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -1171,7 +1171,7 @@ namespace ts {
export interface ParsedBuildCommand {
buildOptions: BuildOptions;
projects: string[];
errors: ReadonlyArray<Diagnostic>;
errors: Diagnostic[];
}

/*@internal*/
Expand Down
1 change: 1 addition & 0 deletions src/compiler/tsbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ namespace ts {
traceResolution?: boolean;
/* @internal */ diagnostics?: boolean;
/* @internal */ extendedDiagnostics?: boolean;
/* @internal */ locale?: string;

[option: string]: CompilerOptionsValue | undefined;
}
Expand Down
10 changes: 10 additions & 0 deletions src/testRunner/unittests/config/commandLineParsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
4 changes: 4 additions & 0 deletions src/tsc/tsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down