Click here to Skip to main content
Licence CPOL
First Posted 26 Feb 2007
Views 23,893
Downloads 442
Bookmarked 36 times

ASP.NET and Globalization

By | 21 Jun 2011 | Article
ASP.NET and Globalization

Introduction

Globalization allows your application to be used by people in different parts of the world who speak in different languages.

Resource Files - Heart Of Globalization

ASP.NET uses resource files to make supporting multiple languages simpler. VS 2005 IDE can automatically generate the resource files (.resx) for storing the different languages.

Mainly there are two types of resources:

  • Local: For single pages
  • Global: For all pages

Step 1: Start New Project

From VS 2005 IDE File -> New -> Web Project
Type the project name as GlobalizationSample.

Screenshot - first.jpg

Step 2: Generate the Resource File

Go to the Design View of Default.aspx.
Add one DropDownList and Label control from ToolBox.

Generate the Local Resource File from Tools -> Generate Local Resources.

Screenshot - generate_Local.jpg

It will generate the local resource file under App_LocalResources.

Screenshot - generate_Local_Result.jpg

Open the Default.aspx.resx file.

Update the Label1 text as follows and save the file.

Label1Resource1.Text : Hello

Step 3: Generate the Resource File for Other Language

  1. Copy the Default.aspx.resx file and paste it in App_LocalResources folder.

    Screenshot - copy.jpg

    Screenshot - paste.jpg

  2. Rename the file as Default.aspx.es.resx (es -> indicates the Spanish culture)

    Screenshot - rename.jpg

  3. Open the file and update the label text as follows:
    Label1Resource1.Text : Hola

    Press Ctrl+F5 for running the application.

Here is the normal output:

Screenshot - english_result.jpg

Change the language in IE options Tools -> IE Options -> Languages.

Screenshot - take_language.jpg

Click Add and select the Spanish language.

Screenshot - select_spanish.jpg

Move up the language to top for default settings.

Screenshot - move_up.jpg

Click OK and refresh the page ........ Cooooool :-)))))

Screenshot - spanish_result.jpg

Full Source & Result

Screenshot - final_code.jpg

Screenshot - Final_Result.jpg

Other ASP.NET Tutorials

License

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

About the Author

A Mahesh

Web Developer

India India

Member

Follow on Twitter Follow on Twitter
Symphony Services, Banglore, 560 087, India

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionDoubt about article PingroupLakshmiNarayana Nalluri19:00 21 Jun '11  
GeneralMy vote of 5 PinmemberZhipeng-Lee16:31 21 Jun '11  
GeneralMy vote of 3 PinmemberDorababu74322:02 14 Nov '10  
GeneralThanks a lot!! PinmemberZentZ7:22 8 Jun '08  
GeneralRegarding Globalization asp.net PinmemberShabeer Ibrahim3:19 18 Jul '07  
GeneralThanks ! PinmemberVertyg08:38 27 Feb '07  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web02 | 2.5.120517.1 | Last Updated 21 Jun 2011
Article Copyright 2007 by A Mahesh
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid