Sdk: dotnet test doesn't respect DOTNET_CLI_UI_LANGUAGE env variable

Created on 23 Jul 2018  Β·  8Comments  Β·  Source: dotnet/sdk

dotnet --info obeys the environment variable, but dotnet test doesn't.

Steps to reproduce

I have 1251 as system default, and I want to enforce en-US for automated grepping of the test results. So your setup nessesary for issue reproduction can differ

$ export DOTNET_CLI_UI_LANGUAGE=en-US

$ echo $DOTNET_CLI_UI_LANGUAGE
en-US

Expected behavior

$ dotnet test Auth.Test
Build starter, please wait...

Actual behavior

$ dotnet test Auth.Test
Π‘Π±ΠΎΡ€ΠΊΠ° Π½Π°Ρ‡Π°Ρ‚Π°, ΠΏΠΎΠ΄ΠΎΠΆΠ΄ΠΈΡ‚Π΅...
ΠŸΠΎΠΏΡ‹Ρ‚ΠΊΠ° ΠΎΡ‚ΠΌΠ΅Π½ΠΈΡ‚ΡŒ сборку...
ΠŸΠΎΠΏΡ‹Ρ‚ΠΊΠ° ΠΎΡ‚ΠΌΠ΅Π½ΠΈΡ‚ΡŒ сборку...
ΠŸΠΎΠΏΡ‹Ρ‚ΠΊΠ° ΠΎΡ‚ΠΌΠ΅Π½ΠΈΡ‚ΡŒ сборку...
ΠŸΠΎΠΏΡ‹Ρ‚ΠΊΠ° ΠΎΡ‚ΠΌΠ΅Π½ΠΈΡ‚ΡŒ сборку...

Environment data

dotnet --info output:

$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.300
Commit: adab45bf0c

Runtime Environment:
OS Name: Windows
OS Version: 6.3.9600
OS Platform: Windows
RID: win81-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.300\

Host (useful for support):
Version: 2.1.0
Commit: caa7b7e2ba

.NET Core SDKs installed:
2.1.200 [C:\Program Files\dotnet\sdk]
2.1.201 [C:\Program Files\dotnet\sdk]
2.1.300 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

PS: You can notice that dotnet --info respects the environmental variable.

Most helpful comment

I'm willing to consider supporting DOTNET_CLI_UI_LANGUAGE in MSBuild -- @cdmihai what do you think? Good idea/bad idea?

All 8 comments

Hi @karyaevsm. Thanks for reporting this issue to us.

The problem is that this output is coming from MSBuild and not the dotnet CLI. It's unfortunately confusing because a lot of the dotnet commands are just wrappers around MSBuild.

@rainersigwald Any thoughts regarding having MSBuild (at least for .NET Core) respect this environment variable for a more seamless experience?

It's unfortunately confusing because a lot of the dotnet commands are just wrappers around MSBuild.

Oh, didn't knew that about tests. First link in Google on "msbuild env change language":

https://stackoverflow.com/questions/40104342/how-to-really-change-msbuild-output-messages-language

I'm willing to consider supporting DOTNET_CLI_UI_LANGUAGE in MSBuild -- @cdmihai what do you think? Good idea/bad idea?

We have a similar issue with Visual Studio, which sets VSLANG: https://github.com/Microsoft/msbuild/issues/1596
This opens the question on whether we should use some tool agnostic language environment variable: https://github.com/dotnet/cli/issues/4988#issuecomment-274273956

I'm fine with MSBuild knowing about both, because of the inertia of history :)

Note that we will convert DOTNET_CLI_UI_LANGUAGE to VSLANG and PreferredUILang in an attempt to make child processes that use those work:

https://github.com/dotnet/cli/blob/58c580dbcc212846d38820d015e73f2d7e80214e/src/dotnet/UILanguageOverride.cs#L30-L35

So you could just respect VSLANG and you'd get this for free.

Nice! I wasn't aware of that. Looks like Microsoft/msbuild#1596 will resolve this then.

I think there may also be a change needed in vstest. I just commented on https://github.com/Microsoft/vstest/issues/821

cc @smadala

Closing this issue as there is no CLI side change for this at the moment and the fixes are being tracked in the right branches already.

Was this page helpful?
0 / 5 - 0 ratings