Multi Language web site in 5 easy steps in 5 minutes

Hello friends,
Here I am with a new topic Localization Globalization. Most of the time our client require website which support multi language so in that case we have to do some extra effort. provides simplest way of how to do this. So friends I am explaining you 5 minimum steps which help us to make a website multi language.
I am talking my favorite 3 languages Hindi, English, Spanish.
So here we go
Step 1:- The first basic step you have to create a resource file which will be your default resource file for your project.
To create resource file you have to open your file then select menu option Tool –> Generate Local resource as shown in below fig


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” means suppose if you have open default.aspx file and you say generate local resource then you will get “default.aspx.rsex” in app_LocalResouce Folder. This will be your default Resource file.
When you open this file you will find. Name & Value & comment column.
Here Name is related with your page control and what should be the value for this controls will be exist in your value column.
For me by default it’s English so there is no issue for English.
Step 2:- Create new resource file for Hindi. For this we will do just copy and paste existing resource file and rename that file and replace the value which we want in Hindi or Spanish. See below fig for it


The things to remember here that when you saving particular language file then the language code should be there for example if I am using Spanish language then my file name will be “Default.aspx.en.resx”
And for Hindi my file name will be “Default.aspx.hi.resx”



Step3:- when you see your file default.aspx then you will find there is extra text with each of your control which is resource key.
For example see below lines here we have resource key lblWelcomeMessageResouce1 this should be present in our resource file. At run time dot net get the value from this key.

  <asp:Label ID=”lblWelcomeMessage” runat=”server” Text=”Hello and welcome “                meta:resourcekey=”lblWelcomeMessageResource1″></asp:Label>

And for drop down we having following code
<asp:DropDownList ID=”ddlLanguage” runat=”server”


                    <asp:ListItem Text=”English” Value=”en-US” Selected=”True”


                    <asp:ListItem Text=”Hindi” Value=”hi-IN” meta:resourcekey=”ListItemResource2″></asp:ListItem>

                    <asp:ListItem Text=”Spanish” Value=”es-MX” meta:resourcekey=”ListItemResource3″></asp:ListItem>


Step 4: I have design my page as shown below.


We have to look for two basic namespace here one is Resource and another is globalization.

Once you done with the above step now you have to set the culture according to your chosen value from drop down.
For that we have to write following code
Protected Overrides Sub InitializeCulture()
Dim _culture As String = Session(“Language”)
If _culture <> String.Empty Then
Dim ci As New System.Globalization.CultureInfo(_culture)
System.Threading.Thread.CurrentThread.CurrentCulture = ci
System.Threading.Thread.CurrentThread.CurrentUICulture = ci

End If

Catch ex As Exception
Throw ex
End Try
End Sub ‘InitializeCulture

Its just override your base class seating. In session we are putting value we have selected in drop down.
On button click event we assign the value (selected dropdown value) in the session.
In this way we get multi language web page.

Step 5:- Just run it 😀


In this way we have finished our minor task
You can download code from

In next few days I will come back with more solid presentation.
Till than
Do Take Care your self
And enjoy coding..


25 thoughts on “Multi Language web site in 5 easy steps in 5 minutes

  1. Hi,

    Very useful post,but i have one question that,how can insert value field on hindi resource file which is appropriat with “Hi and Hello” word,how can we identify that this text display “Namaste aur apka swagat hai” in hindi language.


    1. Hi Kaushal,
      What i did currently i used google hindi translator just typed “Namaste aur aap ka swagat hai” in resource file.
      now resource file having resource key or you can say a id which identify for which control we are writing the test.
      in this manner it handle.
      if you have further query just post a comment with detail.
      Rajat 🙂

  2. Hi There,

    Text in resx files for hindi is coming as square we need to install any language pack or any configuration??

  3. Hi, nice post
    i m developing a hindi web site i need help how to handel unicode fonts for hindi web site please help. + c# (Web Site)+ MSSQL 2005
    the Text Field we have taken as Nvarcahr
    pls helpfor the above.


    1. Hi Vaibhav,
      Thanks for your comment.
      for mutli language save in sql server firstly you have to change collation according to your need secondly you have to change data type to NVARCHAR

  4. Dim _culture As String = Session(“Language”)
    bt what is language..means this object will never use in all project….
    and how to pass on button event..pls…

  5. Sir i wants that my project supports multiple languages
    for example
    user has selected hindi
    then our site matter convert into hindi.

  6. awesome man but tell me that does it means I need to create 15 different resource files and culture settings for 15 different languages?

  7. Hi Rajat ,

    I am working on a Project where our web application supports multi language for 40 different languages. I want to know how to validate the data using Coded UI Tests.

  8. Hi, good explanation,i hv some query
    >does i need to create resource file for each page
    >wht if my data is coming from database, how can i fill in drop down according to current language set.
    >if hindi language is selected and user have to fill his information in text box , how to show entering text in hindi.

    plz reply me i’ll be very thankful.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s