Set CultureInfo.DefaultThreadCurrentUICulture
Gets or sets the default UI culture for threads in the current application domain.
and
Important If you have not explicitly set the UI culture of any existing threads executing in an application domain, setting the DefaultThreadCurrentUICulture property also changes the culture of these threads
But:
if these threads execute in another application domain, their culture is defined by the DefaultThreadCurrentUICulture property in that application domain or, if no default value is defined, by the default system culture. Because of this, we recommend that you always explicitly set the culture of your main application thread and do not rely on the DefaultThreadCurrentUICulture property to define the culture of the main application thread.
So, at start up, on the main thread, set both the CultureInfo.CurrentUICulture
and CultureInfo.DefaultThreadCurrentUICulture
.
And similarly for CultureInfo.DefaultThreadCurrentCulture
and CultureInfo.CurrentCulture
.
None of this will work for operations in threads where the thread either sets its current (UI) culture or explicitly passes a IFormatProvider
to formatting methods or a CultureInfo
to resource getting methods.
Also, both DefaultThreadCurrentCulture
and DefaultThreadCurrentUICulture
were added with .NET 4.5, if you need to target an older version then you are stuck with either setting CurrentCulture
and CurrentUICulture
at every thread start (or pool entry point) or passing an explicit culture for every method that uses locale information (FXCop will help here: can warn for all method calls where this is not done).