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
Step 2: Generate the Resource File
Go to the Design View of Default.aspx.
Label control from
Generate the Local Resource File from Tools -> Generate Local Resources.
It will generate the local resource file under App_LocalResources.
Open the Default.aspx.resx file.
Label1 text as follows and save the file.
Label1Resource1.Text : Hello
Step 3: Generate the Resource File for Other Language
- Copy the Default.aspx.resx file and paste it in App_LocalResources folder.
- Rename the file as Default.aspx.es.resx (es -> indicates the Spanish culture)
- 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:
Change the language in IE options Tools -> IE Options -> Languages.
Click Add and select the Spanish language.
Move up the language to top for default settings.
Click OK and refresh the page ........ Cooooool ))))
Full Source & Result
Other ASP.NET Tutorials