Click here to Skip to main content
11,932,677 members (61,363 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


8 bookmarked

Multilanguage Supporting Urdu and English

, 1 Dec 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
In this article, we discuss a way in which you could manage your site to support multiple languages.


Do you like to support multi-languages to your website? In this article, we discuss a way in which you could manage your site to support multiple languages. We do not say that this piece of writing is the only way of achieving the goal, but this could be a good starting point. The code for this article is written in C# Visual Studio 2010.

Using the Code

protected override void InitializeCulture()
        string lang = string.Empty;
            lang = Request.Form["DdlLanguages"].ToString();
        catch (Exception) { }

        if (lang != string.Empty)
            SetCulture(lang, lang);           
        if (Session["MyUICulture"] != null && Session["MyCulture"] != null)
            Thread.CurrentThread.CurrentUICulture = (CultureInfo)Session["MyUICulture"];
            Thread.CurrentThread.CurrentCulture = (CultureInfo)Session["MyCulture"];

Here we are overriding the InitializeCulture() function. This is called on initializing of page in which we inset the current culture as well as user interface culture properties.

protected void SetCulture(string name, string locale)
        Thread.CurrentThread.CurrentUICulture = new CultureInfo(name);
        Thread.CurrentThread.CurrentCulture = new CultureInfo(locale);
        Session["MyUICulture"] = Thread.CurrentThread.CurrentUICulture;
        Session["MyCulture"] = Thread.CurrentThread.CurrentCulture;


By changing the value of dropdown SetCulture function is called by the two arguments having almost the same values string name, and string locale, to set the CurrentUICulture and CurrentCulture properties by the newly selected language. At the end, save that culture in two different session variables Session["MyUICulture"] and Session["MyCulture"]. Finally, call the base function InitializeCulture().

Step by Step Guide

  1. Create an ASP.NET web site in Visual Studio 2010
  2. Add a page default.aspx 
  3. Add dropdown list box, calendar and label 
  4. Go to design view of your page, in tools menu and click on 'generate local resource' - it will create a file "Default.aspx.resx" in a system directory App_LocalResources
    To write in Urdu, follow these steps.
  5. To write in Urdu, go to control panel, Under Clock Language and Region, click on change keyboards or other input methods
  6. Click keyboard and language tab 
  7. Click change keyboards
  8. Click on add button and choose Urdu and click OK
  9. Click on the tab 'Advanced key settings' and select the language and click change key sequence
  10. Check the enable key sequence checkbox (remember the shortcut key) and press OK
  11. To work in Urdu phonetic keyboard, download it from 
  12. Install it and follow step# 5-10
  13. Copy (Default.aspx.resx) and paste it in the same directory and rename it as (Default.aspx.ur-PK.resx)
  14. Open (Default.aspx.ur-PK.resx), change value of Label1Resource1.Text as you like to write in Urdu, press the short cut key which you set in keyboard settings i.e. (CTRL+0)
  15. Press CTL+F5 to run the project


  • 29th November, 2011: Initial version


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


About the Author

Muhammad Shahid Rasul from Pakistan

You may also be interested in...

Comments and Discussions

Questionyou did a really good job Pin
web Designer25-Apr-14 15:24
memberweb Designer25-Apr-14 15:24 
SuggestionUrdu Components for VB.NET and C# Pin
Naseem_Amjad31-Aug-13 7:03
memberNaseem_Amjad31-Aug-13 7:03 
QuestionMy Vote of 4 Pin
faizan Akhtar Shaikh7-Dec-11 1:55
memberfaizan Akhtar Shaikh7-Dec-11 1:55 
AnswerRe: My Vote of 4 Pin
MuhammadShahidRasul8-Dec-11 19:18
memberMuhammadShahidRasul8-Dec-11 19:18 
GeneralMy vote of 3 Pin
SercanOzdemir1-Dec-11 15:00
memberSercanOzdemir1-Dec-11 15:00 

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
Web04 | 2.8.151126.1 | Last Updated 1 Dec 2011
Article Copyright 2011 by MuhammadShahidRasul
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid