ASP.Net Globalization

Hey Guys!! In this tutorial, I am going to explain you the concept of Globalization with an Example.

Globalization: - Process of creating an application that meets the needs of users from multiple cultures. This process involves more than just translating the user interface of an application into multiple languages – it also includes using the correct currency, date and time format, calendar, writing direction and other issues.

Default.aspx:-
<form id='form1' runat='server'>
    <div>
    <asp:Label ID='lblCulture' runat='server' ></asp:Label>
    </div>
</form>

Default.aspx.cs:-

Don’t forget to add the namespace System.Globalization. Use VB Or C# use this lines to add the namespace.

Using System.Globalization; (C#)

Import System.Globalization; (VB)

In your Page_Load event,add the below lines:-

protected void Page_Load(object sender, EventArgs e)
    {
        string sLang =Request.UserLanguages[0];
        CultureInfo currentCulture= new CultureInfo(sLang);
  lblCulture.Text = currentCulture.EnglishName + ':' + currentCulture.Name.ToLower();
    } 

Your output will be similar to this:-

ASP.Net Globalization

 

Just post back a reply if this article was useful for you. Thanks for reading my article. Happy Coding.Explore more and more as much as possible.

Last updated:3/4/2020 3:48:52 AM
mohan kumar

mohan kumar

Having around 5 Years experience in .NET domain.

1 Comments

Leave Comment