How to display Client browser languages in DropDownList using concepts of localization and Globalization

Localization and Globalization Building a site for a particular culture(language and region)is called localization.Building a site for different culture is called Globalization. The more advanced approach specifies that the content of the web page is not restricted to a few international languages,so that a web page is understandable to masses from all over the world.Displaying the date and time according to the local culture of a region is an example of application Globalization.It provides a culture -specific web experience to the internet users. ASP.NET 4.0 provides built-in mechanisms to globalize web applications that can adapt to different languages.Basically Application Globalization involves two sub-process ,internationalization and localization. Internationalization is the process of internationalizing application code as per some specific standards and Localization is the process of rendering the output of an application according to a specific language and culture.

We will learn this whole concepts in details in coming post.Today we will learn How to display client browser languages in DropDownList control and Add Your specific languages in your browser also.
There are some steps to implement this concepts as given below:-
Step 1 :-First open your visual studio --> File--> New--> Web Site --> Select ASP.NET Empty Website --> OK.Open Solution Explorer--> Add a New Web Page (Default.aspx)--> Now Drag and Drop DropDownList Control from the toolBox on the page as shown below:-

Step 2 :-  Open Default.aspx.cs file --> Add Namespace using System.Globalization; first -->and Write the C# codes as given below:-

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;

public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        string[] slanguage = Request.UserLanguages;
        foreach (string s in slanguage)
            string[] culture = s.Split(';');
            CultureInfo cu = new CultureInfo(culture[0]);

Step 3 :- Now Run the Application(press F5)-->You will see following output as shown below:-
Note:-You can run this application on Mozilla Firefox and Microsoft Internet Explorer also and see culture languages.
Step 4:-If you want to add more languages in your Browser.You can add it. Here i will add some languages in Google Chrome Browser. First Open your Google Chrome -->settings-->Show Advanced Settings (see bottom of the settings page) -->Press Language and Input Settings..-->press Add -->Select your language from the list box and press Done Button as shown below:-

Note:-Here you can change your default language default language of this chrome browser is English(United states).
For More...
  1. .NET Interview Questions and Answers for Freshers 
  2. Object Oriented Programming in C#
  3. Call by value and call by reference in C#
  4. How add captcha image on application easily
  5. How to learn whole concepts of sql server with real life examples 


Post a Comment

Powered by Blogger.