TransWikia.com

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!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP