Some Times our application need to provide comfortable in different languages for different users of different countries and different Geographical regions. A truly international web application should be authored in a way that all users, from different geographical regions, can work with the same level of comfort and see content that they can comprehend how we can we do that ,we can do that by Culture using Globalization in Asp.net.
What is Globalization?
Globalization is the process of designing and developing a software product that function for multiple cultures with little modifications.
Asp.Net localization is managed by the System.Globalization namespace. The globalization functions work with the culture encoding properties of the browser request. We can set the culture encoding in number of ways
You can set the default culture encoding for an entire web application in the configuration file (web. config). This is useful if you know the entire Application needs a specified encoding type. See the following example in System.Web of Configuration section in Web.Config file
Culture encoding can also be set at the page level in the @ Page directive
For example see the following example
<%@ Page Culture="en-US" UICulture="en" ResponseEncoding="utf-8"%>
The culture encoding can also be set programmatically. This requires the use of both the System.Globalization.CultureInfo class and the System.Threading.Thread class. The CultureInfo class is used to specify the culture settings, and the Thread class is used to apply the new culture settings to the current thread
For example see the foolowing sample code
CultureInfo objCI = new CultureInfo ( RadioButtonList1 .SelectedValue .ToString ()) ;
Thread.CurrentThread.CurrentCulture = objCI;
Thread.CurrentThread.CurrentUICulture = objCI;
ResourceManager rm = ResourceManager .CreateFileBasedResourceManager ("resource", Server.MapPath("resources") + Path.DirectorySeparatorChar, null);
Globalization involves two processes
1. Internationalizing the application code
2. Localizing the application to other languages and cultures.
The internationalization process includes steps to translate, store, retrieve, and present application content for any locale, using the same application code base.
A locale is a combination of both language and cultural environments, including the format of dates, times, currencies, telephone numbers, and so on.
The internationalization process of globalization enables to you to remove all content from the presentation layer and from the code base. Only a single code base and a single presentation layout will present content for any culture. This process also enables you to place the content in a location that can be easily translated and that will be programmatically accessible to populate the presentation layer. In addition, the internationalization process allows storing content and user input in a format that can be presented with integrity for the appropriate culture. The internationalization of the application makes the application ready for localization.
The localization process of globalization enables your application to adapt to other locales by translating and formatting content according to culture, without any change in the code. This process also enables removal of any bugs introduced by internationalization, such as accidentally translated file or field names
In addition to System.Globalization namespace there are two more namespaces which are used in the part of Globalization they are System.Resources and System.Threading.
The System.Globalization namespace contains classes that define culture-related information which includes language, country or region, calendars, the date format, currency, numbers, and the sort order for strings. These classes are useful for writing globalized (internationalized) applications. Classes like StringInfo and TextInfo provide advanced globalization functionalities, such as surrogate support and text element processing.
The System.Resources namespace contains classes and interfaces that allow developers to create, store, and manage various culture-specific resources used in an application.
The System.Threading namespace contains classes and interfaces that enable multithreaded programming. The classes of this namespace enable synchronization of thread activities and access to data.
This article Explains about Globalisation in Asp.net