Globalisation & Localization with Asp.Net

Most web applications i have created or been a part of were written for a single language. Now a days i m working on project which supports two languages 1. English 2. Marathi. For this application, I have used globalisation and localization.
Implementing globalisation at the start is much easier than it is after the application has been around for which.Nearly All enterprise applications consider globalisation from the start .
Asp.Net uses resource files to support multiple languages. A resource file contains a language. Specific set of text for a page or the entire site. Your code accesses a resource file based on users requested language .if a resource file exists for that language Asp.Net uses it and thus shows Your site in the requested language . If no resource file exists For the given. Request ,Asp.Net uses the default language setting for the site.

Globalization is defined as the process of developing a program or an application so that it is usable across multiple cultures and regions, irrespective of the language and regional differences.
Localization is the process of creating content, input, and output data, in a region specific culture and language.

Example : I have created a new website. It contains 3 TextBoxes, 1 DropDownList,1 Button and several labels. Now we will see how the contents of this website changes as user selects language.

The first basic step you have to create a resource file which will be your default resource file for your project.

As you done with this option what you will see that in your solution explore a new folder is added with name “App_LocalResources” which having the file name extension “.resx”.
For me by default it’s English so there is no issue for English.
Add another resource file, and name it as Default.en-US.resx. This file is for English(US)language strings.

Add another resource file, and name it as Default.mr-US.resx. This file is for Marathi language strings.

Here Name is related with your page control and what should be the value for this controls will be exist in your value column.

The culture of the website changes dynamically on dropdownlist,s SelectedIndexChanged event.
two namespaces used in this example 1.Resource 2.Globalisation
We can use CultureInfo class to change the culture of the currently executing thread:

ResourceManager rm;
CultureInfo ci;

In this way we get multi language website.

ENJOY CODING…

Leave a comment