79232095

Date: 2024-11-27 22:54:54
Score: 0.5
Natty:
Report link

We had same issue with a mix of Windows 10, 11 and Linux and will list what we did

New version of Windows and Linux use ICU, while older versions will resort to NLS

https://learn.microsoft.com/en-us/dotnet/core/extensions/globalization-icu

ICU has the 4 length for some months

https://github.com/unicode-org/cldr/blob/b0a6207ff224a6cd8ca7f888c8a4740bacb83124/common/main/en_AU.xml#L1833

You can force ICU with two config options

<RuntimeHostConfigurationOption Include="System.Globalization.UseNls" Value="false" />
<RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="<version" />

Then if it makes sense and you always want the same culture regardless of user's setup then add this code to startup locations

CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-AU", false);

The false parameter is to not use the user-selected culture settings from Windows

https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.-ctor?view=net-9.0#system-globalization-cultureinfo-ctor(system-string-system-boolean)

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: andrewjamesbowen