Loading...
 
Multi-Language Add-In for Visual Studio

Multi-Language Add-In for Visual Studio


Thread

Hi, how I can change the language of a thread at runtime? Should I do manually?

Regards

Germany

Hi,

in a Windows Forms application, you can change the language of a Thread by setting the Thread.CurrentUICulture property to an instance of a CultureInfo object.

VB.NET
Imports System.Threading
Imports System.Globalization

Thread.CurrentThread.CurrentUICulture = New CultureInfo ( "en-UK" )

C#
Using System.Threading;
Using System.Globalization;

Thread.CurrentThread.CurrentUICulture = new CultureInfo ( "en-UK" ) ;


If you do this when your program starts (before loading any user interface), then there is no problem.

If you want to change the language later, then changing the language of the thread is only half the story, because it will not immediately change the user interface. One of the features of the Add-In, called Runtime Language Selection is intended to handle exactly this problem.

This is described in the Add-In Help file, if you click open Features and then Runtime Language Selection. Sorry, I don't have time to go into any more detail now.

Best regards
Phil