Globalization and Localization

Ms. Asha Bora has done some studies on Globalization and Localization.. Lets see what she has to say..

Globalization and localization are very important features of .Net framework, which is very useful and about which every programmer should be aware of while creating an application. If I want my application to be used by everyone then I have to make my interface in a language which everyone can understand or say in a global language. But at the same time it is not possible that everyone in the world knows a particular language. So, in order to make those people use the application, I have to publish it in their regional language or say in their local language, this is known as localization .

From the introduction of the article you must have understood the basic meaning of globalization and localization. Now let’s see a proper definition of it in terms of a programmer.

This very important feature is used by .Net to make our programs universal. Now if we talk in term of programming then GLOBALIZATION can be defined as the process of designing and developing an application that function for multiple cultures and regions, irrespective of the language and regional differences and LOCALIZATION is the process of customizing your application for a given culture and locale. It consists primarily of translating the user Interface according to a culture. Culture will decide date display settings (like, mm/dd/yyyy or dd/mm/yyyy), currency display formats etc.

Now, the process by which we can make sure that our program will be localized is known as Internationalization or Globalization. In simpler terms, Globalization can be defined as the set of activities which will ensure that our program will run in regions with different languages and cultures.

Thus, globalization is related to intrinsic (basic) code changes to support such changes we use Resource files etc. Whereas, localization is the process of using a particular culture and regional info so that the program uses the local languages and culture. This means translating strings into a particular local language. This covers putting language specific strings in the resource files. Globalization starts in the main construction phase along with the code development. Localization generally comes later.

Now let’s see how we define the culture and region code.

We all know that languages depend upon the geographical location. For example, French is spoken in France as well as in Canada (besides many other countries). But linguistically speaking, Canadian French is quite different from French spoken in France. Similarly, there are linguistic differences between US English and British English. Therefore, the language needs to be associated with the particular region where it is spoken, and this is done by using locale (language + location).

For example
: fr is the code for French language. fr-FR means French language in France. So, fr specifies only the language and FR specifies the region France whereas fr-FR is the locale. Similarly, fr-CA defines another locale implying French language and culture in Canada. If we use only fr, it implies a neutral culture (i.e., location neutral).

Now, in order to change the current culture, we have to change two properties of the CultureInfo class- UICulture and Culture.

ASP.NET can set the UICulture and Culture properties for the page to the language and culture values that are passed by the browser. Alternatively, you can set the UICulture and Culture properties explicitly, either declaratively or in code. You can also set the values declaratively in
Web.config file under the property and these two properties can be set using the overloaded constructor of the class and then we can use this class to change the culture of the currently executing program.

UICulture: gets/sets the user interface culture for the currently executing thread. This property helps the runtime to load the resource strings from a specific resource. This property can take neutral cultures as well as locales.
  • Thread.CurrentThread.CurrentUICulture = new CultureInfo(“fr”); OR
  • Thread.CurrentThread.CurrentUICulture = new CultureInfo(“fr-CA”);
Culture: gets/sets the region specific culture and formats of currency, dates etc. This needs language as well as location.
  • Thread.CurrentThread.CurrentCulture = new CultureInfo(“fr-CA”); // we have given locale
  • Thread.CurrentThread.CurrentCulture = new CultureInfo(“fr”); // wrong, will not work
In my next article I will talk about “How to implement Globalization in our application”.

References:

  • http://msdn.microsoft.com/en-us/library/ms227427.aspx
  • http://www.codeproject.com/Kb/aspnet/localizationByVivekTakur.aspx

No comments: