In a .Net 4.0 WPF project, we need to keep the same CurrentCulture on each thread then we have on the main thread.
Given, we can initialize a new thread's culture with code like the following:
Keep the information in a variable (context)
context.CurrentCulture = Thread.CurrentThread.CurrentCulture; context.CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
On the new thread, initialize from the saved context
Thread.CurrentThread.CurrentCulture = context.CurrentCulture; Thread.CurrentThread.CurrentUICulture = context.CurrentUICulture;
But in this age of TPL, async programming and lambda delegates, it does not feel right.
And yes, we actually can change the culture while the application is running, but that is another story.
Do you know of any setting, property or config we should initialize to keep track?