C# – Setting current culture for entire solution

cculturemultilingual

I'm trying to support multiple languages in a solution that has multiple projects and threads.

I have 2 resource files, one with English strings, and one with French strings.

I'm setting the current culture as follows:

Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(isEnglish ? "en-US" : "fr-CA");

Is there a way to set the current culture globally, for the entire solution, or do I have to do this for each thread that needs to access strings?

Best Answer

In .NET Framework 4.5, the CultureInfo.DefaultThreadCurrentCulture Property gets or sets the default culture for threads in the current application domain.

In the .NET Framework 4 and previous versions, by default, the culture of all threads is set to the Windows system culture. For applications whose current culture differs from the default system culture, this behavior is often undesirable. In the .NET Framework 4.5, the DefaultThreadCurrentCulture property enables an application to define the default culture of all threads in an application domain.

Related Topic