BitKFu
BitKFu

Reputation: 3697

How to fix CurrentUICulture when creating Threads

I'm using the CurrentUICulture for Localization. This works pretty well until the UI Culture is queried in a different Thread. So my question is how to fix the CurrentUICulture so that it is fix also when I create a new thread.

Currently I'm setting Thread.CurrentThread.CurrentUICulture in the very first line the application starts.

Thanks

Upvotes: 2

Views: 332

Answers (1)

Henk Holterman
Henk Holterman

Reputation: 273264

The CurrentUICulture is only relevant for loading resources and so it should normally only matter to the GUI thread.

When you need it on another thread (I assume to load StringTable resources) then that might be a sign that something is wrong with your main architecture. It shouldn't normally happen.

But if you really need it, it should be possible with a few static variable to hold your CultureInfo and/or resource block.

Upvotes: 2

Related Questions