A unit test is failing. The very brief of it is:
decimal.TryParse("123,456", out decimal d)
Assert.AreEqual(d, 123.456);
Thread.CurrentThread.CurrentUICulture
and Thread.CurrentThread.CurrentCulture
both return en-US
during the test, but cat /etc/default/locale
prints
LANG=en_DK.UTF-8
LC_NUMERIC=en_DK.UTF-8
LC_TIME=en_DK.UTF-8
LC_MONETARY=en_DK.UTF-8
LC_PAPER=en_DK.UTF-8
LC_NAME=en_DK.UTF-8
LC_ADDRESS=en_DK.UTF-8
LC_TELEPHONE=en_DK.UTF-8
LC_MEASUREMENT=en_DK.UTF-8
LC_IDENTIFICATION=en_DK.UTF-8
Is this the expected outcome of .CurrentUICulture
and .CurrentCulture
in this locale?
I would like the program to detect the current culture as Denmark, and parse ','
as a decimal separator, rather than a thousands separator.
Am I tripping over a known issue here? Is the default Culture always American unless I specifically ask the system for a preferred culture and set it?