Our application allows the user to change the Culture that they run it under and that culture can be different than the underlying OS Culture. The only way that I have found of doing this is by setting Thread.CurrentThread.CurrentCulture and Thread.CurrentThread.CurrentUICulture for every thread.
The only problem with this is that we must set the culture for every thread and we need to remember to do this whenever we create a new thread. If you set a thread to another culture, then create a new thread, it gets the culture of the OS, not of the thread that created it.
I would like to find a better way of doing this. I can only think of two things, but I don't know if either are possible.
Any ideas or help would be welcome, even if I need to PInvoke down to the Win32 API. Thanks in advance.
EDIT: I found this question which is similar, but no answer was found.
Two new properties were added to the CultureInfo class in .NET 4.5 which solve this problem, DefaultThreadCurrentCulture and DefaultThreadCurrentUICulture.
Now you can set these two properties and all new threads will be set to the default culture instead of the system culture. These properties will also set the culture for all existing threads that do no explicitly have their culture set.