Localizing ASP.NET Applications

ASP.NET enables you to create applications that are international-ready. These applications can be used in any locale without being modified and recompiled. The process of creating international applications is called internationalization.

When you create international applications, you should consider the following factors:

The language to be used to design the user interface

The locale-specific settings, such as currency formats, date/time formats, and number formats Internationalization is further divided into three subparts: globalization, localizability, and localization. The process of designing and implementing applications that include generic coding and design considerations so that they can adapt themselves according to the locale they are used in is called globalization.

Localizability is an intermediate phase between globalization and localization.

Localizability is a quality-assurance phase, which verifies that a globalized application is ready for localization by separating the resources (that require localization) from the rest of the application. Proper localizability results in a source code that you will not need to modify during localization.

After globalization, the process of working with resources, such as string and image representations for specific locales, is called localization. Localization consists primarily of translating the user interface.

Conceptually, a globalized application can be divided into two parts, a data block, and a code block. The data block part consists of all user interface resources and is localedependent.

On the other hand, the code block part consists of the application code that can work with the data blocks irrespective of locales. Thus, localization involves working with the data blocks for specific locales.

Data can be represented in a number of ways identified as character sets. For localization, you should have a basic understanding of the different character sets.

Character sets

A character set is a set of characters grouped together from different languages. Each character that you input from your keyboard has a code associated with it called a character code. A character code is a unique number that is stored by a computer when you input the character. Thus, a character code is an internal representation of a character in a specific language. Internal tables called code pages, which can include numbers, punctuation marks, and other glyphs, are maintained that are used by operating systems to map keys on keyboards to the characters to be displayed. Some of the different character sets are described as follows:

American National Standards Institute (ANSI): Consists of 256 characters and punctuation codes. Each character is represented as a single byte. This set is sufficient for English applications. However, for most other languages, the ANSI character set is not adequate.
§ Double Byte Character Set (DBCS): A combination of the standard ASCII character set and alphabets from East Asian languages. An ASCII character is represented as a single byte whereas East Asian characters are represented as 2 bytes.

Unicode: Includes characters from almost all major languages that are spoken today. Therefore, multiple code pages are not required to map characters from different languages. Unicode thus provides a single universal code page that includes characters from almost all languages.

Unicode enables you to easily transfer data between different locales. In Unicode, each character is represented as 2 bytes. However, two basic problems are associated with Unicode. First, Unicode increases the file size because it has a large character set. Second, most systems do not support Unicode, which results in problems when Unicode characters are identified on a network.

To address these problems, Unicode Transformation Formats (UTFs) can be used. UTFs use a technique wherein the Unicode characters are encoded as byte values so that they can be understood by systems that do not support Unicode. The most commonly used UTF is UTF-8, which encodes Unicode characters to single-byte characters.

Setting Culture and Region

In addition to the configuration settings, you can use the classes provided by the .NET Framework to create international applications. These classes are contained in the System.Globalization namespace. In addition to these classes, you can use the Thread class of the System.Threading namespace to control the locale-specific settings for each executing instance of an application. The Thread class represents the threads that execute within the runtime.

System.Globalization namespace

The System.Globalization namespace contains classes that enable your applications to determine the locale at run time. This gives you the flexibility of creating applications that can automatically adapt themselves to the locale in which they run. The classes of the System.Globalization namespace define culture-related information, such as the language, the country/region, the calendars in use, the format patterns for dates, currency, and numbers, and the sort order for strings. The following sections describe the CultureInfo and RegionInfo classes of this namespace.

When you make an application, it is a part of an assembly called the main assembly. If any change is made to this main assembly, you need to recompile the application. Because you might need to add the resources to provide support for more cultures, it is advisable to keep only the default set of resources in the main assembly. The other sets of resources can be kept in separate assemblies called satellite assemblies, which contain only resources. Therefore, changes made to these assemblies do not require you to recompile the application.

System.Resources namespace

The .NET Framework provides a class library that uses these resource files to retrieve resources for different languages at run time. The classes that allow developers to create, store, and manage various culture-specific resources used in an application are included in the System.Resources namespace. Some of the classes of this namespace are described as follows:

ResourceManager: Represents a set of all the resources to be used in an application at the time of execution. This class provides many constructors that you can use to create its objects.

The choice of the constructors depends on the need and the scenario in which you want to use resources. For example, when you need to retrieve resources from an assembly, you can use the constructor that takes three parameters: baseName, Assembly, and Type.

RELATED POST

CREATING ASSEMBLIES WITH ASP.NET

BUILDING HANDLERS IN ASP.NET

INTERFACES AND CLASSES CREATION IN ASP.NET

CACHING IN ASP.NET

CACHING IN ASP.NET PART TWO

WIRE LESS APPLICATION WITH ASP.NET

SECURITY IN ASP.NET PART ONE

SECURITY IN ASP.NET PART TWO

LOCALIZING ASP.NET APPLICATIONS

DEPLOYING ASP.NET APPLICATIONS

ASP.NET CONFIGURATION SYSTEM

WEB SERVICES IN ASP.NET

WEB SERVICES PART TWO

WEB SERVICE INFRASTRUCTURE

WEB SERVICE INFRASTRUCTURE PART TWO

EXCHANGING MESSAGES IN ASP.NET

MICROSOFT HAIL STORM

SOAP AND DOT NET PART ONE

SOAP AND DOT NET PART TWO


No comments:

Post a Comment