Skip to content

Commit 36df28d

Browse files
authored
Merge pull request #31986 from microsoft/buildLocale
Support --locale with --build
2 parents 796d5bb + 06d188a commit 36df28d

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

src/compiler/commandLineParser.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ namespace ts {
147147
category: Diagnostics.Basic_Options,
148148
description: Diagnostics.Enable_incremental_compilation,
149149
},
150+
{
151+
name: "locale",
152+
type: "string",
153+
category: Diagnostics.Advanced_Options,
154+
description: Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us
155+
},
150156
];
151157

152158
/* @internal */
@@ -698,12 +704,6 @@ namespace ts {
698704
category: Diagnostics.Advanced_Options,
699705
description: Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files
700706
},
701-
{
702-
name: "locale",
703-
type: "string",
704-
category: Diagnostics.Advanced_Options,
705-
description: Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us
706-
},
707707
{
708708
name: "newLine",
709709
type: createMapFromTemplate({
@@ -1171,7 +1171,7 @@ namespace ts {
11711171
export interface ParsedBuildCommand {
11721172
buildOptions: BuildOptions;
11731173
projects: string[];
1174-
errors: ReadonlyArray<Diagnostic>;
1174+
errors: Diagnostic[];
11751175
}
11761176

11771177
/*@internal*/

src/compiler/tsbuild.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ namespace ts {
172172
traceResolution?: boolean;
173173
/* @internal */ diagnostics?: boolean;
174174
/* @internal */ extendedDiagnostics?: boolean;
175+
/* @internal */ locale?: string;
175176

176177
[option: string]: CompilerOptionsValue | undefined;
177178
}

src/testRunner/unittests/config/commandLineParsing.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,16 @@ namespace ts {
486486
});
487487
});
488488

489+
it("parse build with --locale en-us", () => {
490+
// --lib es6 0.ts
491+
assertParseResult(["--locale", "en-us", "src"],
492+
{
493+
errors: [],
494+
projects: ["src"],
495+
buildOptions: { locale: "en-us" }
496+
});
497+
});
498+
489499
it("parse build with --tsBuildInfoFile", () => {
490500
// --lib es6 0.ts
491501
assertParseResult(["--tsBuildInfoFile", "build.tsbuildinfo", "tests"],

src/tsc/tsc.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ namespace ts {
186186
// Update to pretty if host supports it
187187
updateReportDiagnostic(buildOptions);
188188

189+
if (buildOptions.locale) {
190+
validateLocaleAndSetLanguage(buildOptions.locale, sys, errors);
191+
}
192+
189193
if (errors.length > 0) {
190194
errors.forEach(reportDiagnostic);
191195
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);

0 commit comments

Comments
 (0)