Where System.Threading.Thread.CurrentThread.CurrentCulture is set

Stack Overflow Asked by Hidalgo on November 2, 2020

Where is System.Threading.Thread.CurrentThread.CurrentCulture set? I have a US customer (and I am in US); the debugging code shows the value equals "en-GB". And therefore dates are shown in British format (‘DD/MM/YYYY’). Where is this set, in which file?

2 Answers

You can force current CultureInfos by CultureInfo.CurrentUICulture and CultureInfo.CurrentCulture.

The first one effects to text based things such like datetime etc. The second one effects to numbers such like floating points. Setting both to same CultureInfo is basic implement.

Note that, this will work fine if you don't consider multi-languages. Or you need to add language selecting menus.

Correct answer by donggas90 on November 2, 2020

Generally, CultureInfo comes from the OS (presuming it's not explicitly overridden in code); in case of a web application, CultureInfo typically comes from the client OS, via HTTP's Accept-Language header (you can likely monitor this with tools like Fiddler, etc).

In your case, if it's possible to ask the client to check their system setting - on Windows 10, the PowerShell command Get-Culture will return the current culture set in the OS, for instance - you might be able to determine the source of the problem.

Furthermore, it is possible to set a different culture for the current user (no Admin required, I believe), using the PowerShell Set-Culture -CultureInfo en-US command, where en-US is the desired culture (no pun intended). There is also a way to reset it for the entire machine, with the PowerShell Set-WinSystemLocale -SystemLocale en-US command (Admin rights and a reboot are required).

Answered by CoolBots on November 2, 2020

Add your own answers!

Related Questions

CS50 Credit Card Validation

1  Asked on November 18, 2021


Regex Multiple Parenthases

1  Asked on November 18, 2021 by matthewproskils


can anyone explain me the background process of this code

1  Asked on November 18, 2021 by funtastic-world


How is “from” in python can copies

2  Asked on November 18, 2021 by joox


Python Iterating through List of List

3  Asked on November 18, 2021 by jaydaman


Pytest environment fixtures not seen by imported class

1  Asked on November 18, 2021 by pmdaly


Load RabbitMQ config at startup

1  Asked on November 18, 2021 by david-vasandani


OnChanged State of Checkbox in Flutter

1  Asked on November 18, 2021 by ruchita-bhaskar


json encode and decode is not working in PHP

4  Asked on November 18, 2021 by nallammal-t


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP