How to Create Multiple Language Website in Asp.net C#

6
Our Reader Score
[Total: 2 Average: 3.5]

  Multilingual Website in Asp.net C# : In this tutorial, we are going to create multi-language website in Asp.net C#. A website which can support Multiple Language and change according to the culture of a specific geographical location is not a new topic. Web sites to support multiple languages can be a challenging and time-consuming process.

You find many articles related on internet and well explained, But I still see that many of them are complicated for “Beginners”. I tried to make this article approach a more dynamic way to manage languages regarding Globalization/ Localization/ Culture concepts.

With standard HTML pages, you may have to create and maintain duplicate versions of each page for each supported language as well as having the language content embedded into the HTML, where content can’t easily be edited.

For those of you who have to develop multi-lingual interfaces and applications, you’ll be glad to know that ASP.NET makes things easier.

ASP.NET and the .NET framework ship with support for multilingual applications multiple language website, namely in the form of Resource Files, the CultureInfo class, and the System.Globalization and System.Resources.ResourceManager namespaces.


First we need to understand what is meant by globalization, localization and culture in this context.

Globalization: Globalization is a process of identifying all the parts of your application that need to be different for respective languages and separate them from the core application.

Localization:  Localization is a process of creating and configuring your application for a specific language.

Cultures:  A culture is a combination of the language that you speak and the geographical location you belong to. It also includes the way you represent dates, times, and currencies.

It’s important to have a good understanding of Cultures since our new code will make use of them – specifically the System.Globalization.CultureInfo class, and the culture name value which follows the RFC 1766 naming standard. Basically, you create a new CultureInfo instance by specifying the culture name in the constructor:


Follow the step to create  multiple language websites ( Multilingual ):

Step 1:
Create new website⇒ Solution Explorer⇒ Select sln right click and Add Asp.Net Folder – App_GlobalResources;
Now under App_globalization add resources file (.resx  file), I add three resx file default for English, fr for french, de for german having key pair values;
Structure look like as shown in below image:
A website which can support Multiple Language
Step 2:
Add Global.asax file: Code: write this piece of code

 

Step 3: Add masterPage having a drop-down list control;

Code:

Add childPage with controls and on drop-down list selected index it will display respective language content My sample Child page design code : set text as resources key; i.e Text="<%$Resources:Resources,FieldName %>"


 

ScreenShots :

OutPut   1) For English

create multiple language website in asp.net c#

2) For French
create multiple language website in asp.net c#
Resx file asp.net c#. System.Globalization and System.Resources.ResourceManager
Hope you enjoyed this tutorial. If you have any recommendations, please let us know what you think in the comment section below! See you again next time!

Get your Printable Copy

6 COMMENTS

  1. Very good,., Just wanted to add that to update existing cookie use

    HttpContext.Current.Response.SetCookie(new HttpCookie(“CultureInfo”, ddlanguage.SelectedValue));

LEAVE A REPLY