Click here to Skip to main content
13,149,073 members (57,847 online)
Click here to Skip to main content
Add your own
alternative version


26 bookmarked
Posted 5 Apr 2007

Satellite Assembly Demo by Using 12 Languages in C#

, 5 Apr 2007
Rate this:
Please Sign up or sign in to vote.
This demo is nothing new. It just shows the usage of localization using resource files for 12 languages.


Hi everyone, this is my second article on The Code Project. Like the first one, I expect some feedback from you for this article as well. Thank you in advance!

Here I have worked on the localization concepts that have been introduced in .NET 2.0. But these concepts are nothing new.

Using the Code

I will list the methods with some brief explanation. I am not following Best Practices in Code Design. Since the concepts are not new, I have not explained much.

<asp:DropDownList ID="DropDownList1" runat="server" Width="161px" AutoPostBack="True">
                <asp:ListItem Value="en-US">Default</asp:ListItem>
                <asp:ListItem Value="ar-AE">Arabic</asp:ListItem>
                <asp:ListItem Value="fr-FR">French</asp:ListItem>
                <asp:ListItem Value="de-DE">German</asp:ListItem>
                <asp:ListItem Value="it-IT">Italian</asp:ListItem>
                <asp:ListItem Value="pt-PT">Portuguese</asp:ListItem>
                <asp:ListItem Value="ru-RU">Russian</asp:ListItem>
                <asp:ListItem Value="el-GR">Greek</asp:ListItem>
                <asp:ListItem Value="hi-IN">Hindi</asp:ListItem>
                <asp:ListItem Value="ja-JP">Japanese</asp:ListItem>
                <asp:ListItem Value="ta-IN">Tamil</asp:ListItem>

Here, I have first added 12 languages in the dropdownlist.

Then, I have added a div in which the text is inserted as ASP literal control.

<asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:Resource, Language%>"> 
<asp:Literal ID="Literal2" runat="server" 

	Text="<%$ Resources:Resource, Language_Name%>"> 

Below this, I added a Label in which the text changes when a button is clicked. This is to show how to change the culture on a button click.

The design of the page will be:

Screenshot - design.gif

Now the code that is written in code behind:

C# provides an overridden method called InitialCulture(). In this method, we wrote the following code so that whenever the page is loaded, this method is invoked.

protected override void InitializeCulture()
      string culture = Request["DropDownList1"];
      if (culture == null)
         culture = "en-US";
      Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
      Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture);

In the Click event of the button, we write the following code:

protected void Button1_Click(object sender, EventArgs e)
        Label1.Text = Resources.Resource.Welcome;


Screenshot - output1.jpg

Screenshot - output2.jpg

Screenshot - output3.jpg

Screenshot - output4.jpg

Screenshot - output5.jpg

Points of Interest

The code is very simple and easy to write. Thus we can implement a resource file for any number of cultures.

In my next article, you will see how we can read the resource contents by using Resource file readers and how to edit the resource contents by treating resource files as an XML File.


If you find this article useful, I will appreciate your feedback. Thank you.

Expect more from me SOON!


  • 5th April, 2007: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

No Biography provided

You may also be interested in...


Comments and Discussions

Generalgood but Not Complete Pin
jainpr17-May-11 23:33
memberjainpr17-May-11 23:33 
GeneralMy vote of 1 Pin
Elmar de Koning1-Dec-10 22:20
memberElmar de Koning1-Dec-10 22:20 
GeneralMy vote of 1 Pin
anant.sinha10-Feb-10 10:44
memberanant.sinha10-Feb-10 10:44 
GeneralGot my 5 for "TAMIL" Pin
Nagaraj Muthuchamy25-Feb-09 23:04
memberNagaraj Muthuchamy25-Feb-09 23:04 
GeneralA very Goood Article Pin
Member 448984518-Dec-08 19:04
memberMember 448984518-Dec-08 19:04 
GeneralGood Article Pin
Ganesan Sankaran16-Oct-07 2:40
memberGanesan Sankaran16-Oct-07 2:40 
Generalgood example Pin
code_proj_18-May-07 15:40
membercode_proj_18-May-07 15:40 
QuestionNice but, now what? Pin
root@ccess7-Apr-07 0:27
memberroot@ccess7-Apr-07 0:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.170924.2 | Last Updated 6 Apr 2007
Article Copyright 2007 by Saleth Prakash
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid