Click here for Vacation Photos

Globalization and Localization Facts

If your application will be used in multiple countries or languages, you should consider the following aspects when creating the application:

  • Globalization is the formatting of data based on a locale or region. It only deals with formatting the output of data, it does not change the value of the data. For example, globalization will not convert U.S. dollars to Japanese yen, but globalization will format the output as U.S. dollars or Japanese yen.
  • Localization is the process of adapting an application to a region and includes changing the user interface (such as moving buttons) and providing translated or otherwise different versions of the application. Different versions share the same logic, but have different interfaces.

With both globalization and localization, various elements within the user interface are modified based on the current culture. The culture definition accommodates both language and regional (often country) differences. Culture information is set and modified using the following:

Construct Description
CultureInfo Class The System.Globalization.CultureInfo class is used to hold information about different cultures such as:

  • The name of the culture.
  • The writing system.
  • The calendar used.
  • Other culture specific information such as date and currency formats.

The CultureInfo class requires that a culture code be passed to its constructor on creation.

  • The culture code can be passed as a string or an int.
  • The string for a culture code generally looks like: en-us. The first two characters specify the language and the last two specify the region. In this case the language is English and the region is the United States.
Thread.CurrentCulture Property CurrentCulture is a property of a thread that identifies the cultural settings used for globalization by the thread. The CurrentCulture property returns a CultureInfo object that includes the culture information.You can get this property as shown in the following example:

CultureInfo culture =
System.Threading.Thread.CurrentThread.CurrentCulture;

The CurrentCulture Property also allows setting the CurrentCulture programmatically. For example:

CultureInfo culture = new CultureInfo("en-us");
System.Threading.CurrentThread.CurrentCulture = culture;

The default setting is the user’s Locale set through the Regional Options applet in the Control Panel.

Thread.CurrentUICulture Property CurrentUICulture is a property of a thread that identifies the cultural settings used for localization. You can get and set this property in the same way you get and set the CurrentCulture property.The default value for the CurrentUICulture is the operating system’s UI Language. For multi-language versions, the user UI Language settings are used.

The following table describes how to customize your application for a specific culture.

Action Description
Globalization As you globalize an application, consider cases in your code where data is displayed in given format (such as currency, dates, and decimal numbers). It’s common in a non-globalized application to hard-code the display and formatting of these values. The following example forces the display of the value 5000:

txtNonGlobalized.Text = "$5,000";

To globalize this data, use the ToString method passing the formatting character. The following example displays the value 5000 as currency (the system will format the display based on the current culture).

txtGlobalized.Text = (5000).ToString("C");
Localization Localization involves creating alternate user interface layouts (and text) for different cultures.

  • Localization uses resource files (*.resx) to hold the language, culture, and locale-specific contents.
  • The resource files are used to populate the text properties for the controls on the user interface for a particular language and culture.
  • In addition to storing text, resource files can also store icons and graphics that are specific to different regions or cultures.
  • The correct resources will be loaded at runtime based on the CurrentUICulture.

The following steps outline how to localize a form.

  1. Create the default culture version.
  2. Set the form’s Localize property to true.
  3. Set the form’s Language property to the desired language.
  4. Modify the form for the specified language by changing text and moving, adding, or deleting controls.
  5. Build the application. This will create the corresponding .resx files.

When the application runs, the appropriate resources will be loaded for the CurrentUICulture.



Digg it | Save to del.icio.us | Netscape | Reddit | Stumble It!

- - - - - S P O N S O R I N G     A D V E R T I S M E N T - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Post your thoughts in the Comments ...
Not signed up to share your ideas & thoughts?

It’s free and easy to collaborate!
Click Here to begin

Click Here to earn money for reviewing this post

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Leave a Reply

You must be logged in to post a comment.