Click here to Skip to main content
11,922,905 members (48,269 online)
Click here to Skip to main content
Add your own
alternative version


18 bookmarked

Creating Multilingual and Localized Pages in .NET

, 14 Sep 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
Article describes how to create multilingual, localized pages in .NET


Here I will discuss how to develop multilingual and localized pages in .NET web applications. The main problem with the multilingual application is reset the current culture, language each time page is postback because it may reset to the default language/culture. I will also discuss use of resource files for multilingual application and also approaches to localize images.


Let us start this exercise in steps.

  1. Create your own base page class: The problem with multilingual application as I discussed earlier is that it might reset the culture back to the default during page postback. To tackle with this issue .NET provides us a method which is part of page life cycle to initialize culture. So we can write our own class inherited from System.Web.UI.Page class and override its InitializeCulture method as follows:
protected override void InitializeCulture()
    //get the culture information from wherever you want suppose it is a property
    //with your user class

    Thread.CurrentThread.CurrentCulture = 
    Thread.CurrentThread.CurrentUICulture = new 


Now override each of your aspx page with your own class instead of Page class. And it will reset the current culture as per your requirement.

  1. Using resource file: Resource files are the .resx extension file where you can keep content of your web pages to choose according to the language. You should keep 1 resource file for each language your application support. Now the question is how to pick values from these resource files, no problem, its jus matter of couple of lines of code:
ResourceManager rm =new ResourceManager(“Name of resource file”,
    Assembly. GetExecutingAssembly());


To avoid few compile time error in above code add following namespace in your code

Using System.Resources;

Using System.Reflection;
  1. Localizing Images: For localizing images you can choose any one of two approaches. First keep of name of all images in the resource file and access image path like this:
imageButton1.ImageUrl= rm.GetString(“imagepath1”);

Other approach which I prefer is to keep all images of one language in one folder and keep name of that folder in your resource file but remember to keep same name for a image in all language.

imageButton1.ImageUrl= rm.GetString(“ImageFolder”) +”LoginImage.jpg”;


Here we have discussed about creating localized pages in .NET application. We discussed that how to set culture in each page trip. Then we discussed how to pick values from resource file and the we discusssed approaches for localizing images of your application. Hope it helps. Thanks.


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


About the Author

dixit gaurav
Web Developer Nagarro Software Pvt Ltd Gurgaon India.
India India
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralNeed more detail Pin
Donsw20-Jan-09 18:01
memberDonsw20-Jan-09 18:01 
GeneralMy vote of 2 Pin
Donsw20-Jan-09 18:00
memberDonsw20-Jan-09 18:00 
GeneralMy vote of 2 Pin
Member 196961510-Dec-08 2:39
memberMember 196961510-Dec-08 2:39 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151125.1 | Last Updated 14 Sep 2008
Article Copyright 2008 by dixit gaurav
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid