Globalization in Asp.net
What is globalization ?
In Globalization, an application is developed to support various languages and cultures.
Globalization is the process of making an application that supports multiple cultures without mixing up the business logic and the culture related information of that application.
How to implement globalization in .net application?
in code behind you require
using System.Globalization;
using System.Threading;
Add => Add Asp.Net Folder => App_GlobalResources
Add => Add Asp.Net Folder => App_LocalResources
Now add resouce file in App_GlobalResources folder as per your need
MyResource.en-GB.resx
MyResource.en-US.resx
MyResource.fr-FR.resx
MyResource.hi-IN.resx
Now take a asp:Label and set the text property Text="$ Resources:MyResource, WelcomeText"
Finally initialize the culture
protected override void InitializeCulture()
{
string _language = Request.QueryString["language"];
if (!string.IsNullOrEmpty(_language))
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo(_language);
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(_language);
}
base.InitializeCulture();
}
Now you are done ! just click the hindi link to see the changes
Hindi ||
French
Welcome Message :
Swagatam ! Ayeea