Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Allow CLI UI language to be overridden by an environment variable - #7021

Merged
nguerrera merged 4 commits into
dotnet:release/2.0.0from
nguerrera:loc-override
Jul 19, 2017
Merged

nguerrera merged 4 commits into
dotnet:release/2.0.0from
nguerrera:loc-override

Conversation

@nguerrera

Copy link
Copy Markdown
Contributor

Customer scenario

Customizing the UI language for messages from the CLI and downstream tool without changing the user/system default globally.

Bugs this fixes:

#4988

Workarounds, if any

None

Risk

Low

Performance impact

None

Is this a regression from a previous update?

No

Root cause analysis:

This was planned work. We had considered leaving it until 2.1, but we need it now so that we can easily enable automated runs of unit tests with translation enabled.

How was the bug found?

Not a bug. The small feature was initially reported by a customer. And we also need it for loc testing.

@livarcocc @dotnet/dotnet-cli for review

@MattGertz for approval

@nguerrera

Copy link
Copy Markdown
Contributor Author

Compilation error was a last minute parameter rename during self-review. I'll fix it tomorrow.

@nguerrera nguerrera changed the title Allow CLI UI language to be overridden by an environment variable [NO MERGE] Allow CLI UI language to be overridden by an environment variable Jun 29, 2017
@nguerrera

Copy link
Copy Markdown
Contributor Author

Marking [NO MERGE] while I work on getting tests to exercise this.

@DustinCampbell

Copy link
Copy Markdown
Member

@nguerrera: Are you still planning to add some tests around this?

@nguerrera

Copy link
Copy Markdown
Contributor Author

Yes. I've been preempted this week back from vacation with some higher priority things, but it's not forgotten.

Also fix some incorrect unlocalized test expectations that slipped in.
@nguerrera nguerrera changed the title [NO MERGE] Allow CLI UI language to be overridden by an environment variable Allow CLI UI language to be overridden by an environment variable Jul 19, 2017
@nguerrera

Copy link
Copy Markdown
Contributor Author

@livarcocc Test issue has been addressed. PTAL.

Comment thread src/dotnet/Program.cs
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

// Honor UI language customization
UILanguageOverride.Setup();

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

{
return new CultureInfo(dotnetCliLanguage);
}
catch (CultureNotFoundException) { }

This comment was marked as spam.

This comment was marked as spam.

{
return new CultureInfo(vsLcid);
}
catch (ArgumentOutOfRangeException) { }

This comment was marked as spam.

}

// Make the current process respect the override.
CultureInfo.DefaultThreadCurrentUICulture = language;

This comment was marked as spam.

This comment was marked as spam.

CultureInfo language = GetOverriddenUILanguage();
if (language != null)
{
ApplyOverrideToCurrentProcess(language);

This comment was marked as spam.

@nguerrera

Copy link
Copy Markdown
Contributor Author

@nguerrera
nguerrera merged commit 86d9577 into dotnet:release/2.0.0 Jul 19, 2017
@nguerrera
nguerrera deleted the loc-override branch July 19, 2017 20:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants