Dela via


Using the CurrentUICulture Property

The CurrentUICulture property represents current user interface culture on a per-thread basis. This property is used by the ResourceManager class to look up culture-specific resources at run time. Your application can use a neutral or specific culture, or the InvariantCulture to set the CurrentUICulture property. The application can use the CurrentThread property to set CurrentCulture.

Explicitly Setting the CurrentUICulture Property

Your application can set the CurrentUICulture property explicitly. The following code example sets the property to the neutral culture German ("de").

Thread.CurrentThread.CurrentUICulture = new CultureInfo("de")
Thread.CurrentThread.CurrentUICulture = new CultureInfo("de");

The application can also explicitly set CurrentUICulture to a specific culture. The following code example sets the property to the specific culture German (Germany), designated "de-DE".

Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE")
Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");

Implicitly Setting the CurrentUICulture Property

If the CurrentUICulture property is not set explicitly in application code, it is set by default when the application starts. This setting uses the GetUserDefaultUILanguage function on Windows 2000 and Windows XP Multilingual User Interface (MUI) products for which the user can set the UI language through the regional and language options in Control Panel. If the user does not set the UI language, the system-installed language, which is the language of the operating system resources, sets it.

See Also

Concepts

Using the CultureInfo Class

Using the CurrentCulture Property

Using the InvariantCulture Property