Closed
Description
Description
In previous versions of .NET (including core) CultureInfo.CurrentUICulture
returned the UI language i chose for displaying on Windows.
Starting with .NET 5.0 this is no longer the case and instead my chosen region format is returned.
I think this is a huge breaking change.
I first noticed this when installing the preview SDK version, compiled and received all output in german, which is definitely not what i want.
Configuration
Other information
Sample program:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
</PropertyGroup>
</Project>
using System;
namespace locale_tests
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("System.Globalization.CultureInfo:");
Console.WriteLine("CurrentCulture : " + System.Globalization.CultureInfo.CurrentCulture);
Console.WriteLine("CurrentCulture (F): " + System.Globalization.CultureInfo.CurrentCulture.GetConsoleFallbackUICulture());
Console.WriteLine("CurrentUICulture : " + System.Globalization.CultureInfo.CurrentUICulture);
Console.WriteLine("CurrentUICulture (F): " + System.Globalization.CultureInfo.CurrentUICulture.GetConsoleFallbackUICulture());
}
}
}
Output with net48 is:
PS C:\DEV\Projects\locale_tests> dotnet run -f net48
System.Globalization.CultureInfo:
CurrentCulture : de-DE
CurrentCulture (F): de-DE
CurrentUICulture : en-US
CurrentUICulture (F): en-US
Output with netcoreapp3.1 is:
PS C:\DEV\Projects\locale_tests> dotnet run -f netcoreapp3.1
System.Globalization.CultureInfo:
CurrentCulture : de-DE
CurrentCulture (F): de-DE
CurrentUICulture : en-US
CurrentUICulture (F): en-US
Output with net5.0 is (5.0.100-preview.4.20258.7):
PS C:\DEV\Projects\locale_tests> dotnet run -f net5.0
System.Globalization.CultureInfo:
CurrentCulture : de-DE
CurrentCulture (F): de-DE
CurrentUICulture : de-DE
CurrentUICulture (F): de-DE