Change the .NET Core display language

Change the .NET Core display language

ยท

2 min read

Habits and languages

We all have our habits. It also affects those of us who write software. A habit of many programmers is the display language of the programming language.

We are used to reading the compiler's messages in a certain language! And this is not necessarily our mother tongue or the language of the country we live in.

When I learned to program, I always had everything in english, so that framework messages in another language now irritate me.

Not that we don't understand the messages, but it looks strange and sometimes there are more and better explanations to be found in other languages than in the system language.

The case of the .NET Core installation package

The .NET Core installation package comes with a few language packs (cs, de, en, es, fr, it, ja, ko, pl, pt-BR, ru, zh-Hans, zh-Hant), but sets the operating system language as a default one, which may not be the language in which we want to see the messages.

The language directories could be found in the .NET Core SDK folder (run dotnet --info in a command prompt / terminal and look for the Base Path entry). In my case on Windows: C:\Program Files\dotnet\sdk\3.1.401\.

What can you do?

You can change the .NET Core display language using an environment variable.

  • The name of the variable is DOTNET_CLI_UI_LANGUAGE.
  • The value is the language locale code (for example: en or pt-BR).

How to change the display language

  • Open a command prompt / terminal
  • Check the current display language (for example by running dotnet --help): dotnet_display_language_01.jpg In my case it is in german.
  • Set the DOTNET_CLI_UI_LANGUAGE variable to the desired language. Example to set it to english: set DOTNET_CLI_UI_LANGUAGE=en
  • Check the result (for example by running dotnet --help again): dotnet_display_language_03.jpg

And that was it. More (historical) details about the environment variable can be found on GitHub in this issue: github.com/microsoft/vstest/issues/821

Conclusion

As I often tend to forget such details like the name of the variable, I tweetet recently about it. ๐Ÿ˜

If you have any questions, don't hesitate to ask me using the comments section.

Did you find this article valuable?

Support Pavel by becoming a sponsor. Any amount is appreciated!