Localization and Globalization in C#: Introduction
.NET is equipped with powerful, yet simple, application localization and globalization mechanisms.
Localization is the process of translating resources to a specific culture. On the other hand, globalization is the process of designing applications that can adapt to different cultures. Basically, when you select the application language, you need to specify the culture the selected language is used in. For example, English language is used in United States, Canada and Great Britain, among other countries. Although, people in these countries are using the same language, their cultures are different (i.e.: date and time format differences, currency is different, etc.). There is a standard for designating the cultures. A list of currently available cultures can be found here.
In the heart of localization and globalization mechanism in the .NET framework is the System.Globalization namespace. In the heart of this namespace is the CultureInfo class with its static properties. Some of those properties are InvariantCulture, CurrentCulture, CurrentUICulture, etc.
CurrentCulture property has a lot to do with the Regional Settings in your Control Panel. Basically, Regional Settings in your Control Panel is the place where can you set how you want your date, time, currency and other stuff to appear in your Windows. CurentCulture static property reflects that setting.
On the other hand, CurrrentUICulture is in connection with the Windows itself. Most of us are using English version of Windows, to be more precise “en-US” version of Windows, but there are other Windows localizations available on the market. CurrentUICulture property reflects the Windows language.
In another words, if your Windows is in English (all messages, titles, captions, etc.), your CutureInfo.CurrentUICulture is “en-US”. This setting has nothing to do with the Regional Settings you have set in your Control Panel. Your CutlureInfo.CurrentCulture can be set to “fr-FR” on the “en-US” Windows. This setting will affect only date, time, currency and other display formats.
Tags: .NET, C#, globalization, localization