Click here to Skip to main content
12,554,442 members (84,411 online)
Click here to Skip to main content
Add your own
alternative version


47 bookmarked

Multilingual Support in C#

, 18 Oct 2002
Rate this:
Please Sign up or sign in to vote.
The article gives an introduction on how to develop multilingual applications using C#


The computer is now in use in almost all parts of the world and therefore work is in progress to give support to languages other than English. Many major languages of the world like Arabic, Hindi and Chinese are not written in Roman Script, so special features are provided for dealing with these languages. This article will tell how to implement multilingual application using C#. Our Example Script will be Arabic. But it can be generalized to any major language of the world.


C# stores character in the form of Unicode Characters. Unicode is a 16 bit encoding scheme of characters and has characters of all major languages of the world like Arabic, Urdu, Hindi, Chinese, Korean, Hebrew etc. Every character has a Unicode code point, e.g. Arabic Character Aleph has codepoint 1575. To display different languages and script, one has to install support for the script. Windows 2000 has support for displaying many scripts. Script is the writing style of language. For example, English and many western languages are written in Roman Script. Arabic, Farsi, Urdu are written in Arabic Script. Hindi, Bengali, Tamil are written in Indic Script. Every script has its own features. Arabic Script is written from left to right and characters changes their shape according to the context.

To install support for Arabic or any other Script. Open Control Panel --> Regional Options --> Language Setting for the System and check your desired Script (Arabic in our case). After checking Arabic click on OK and Arabic Script support is installed on your computer and you can have input locale in Arabic, Farsi and Urdu.

Regional Options

For input, keyboard for Arabic, Farsi and Other languages can be installed from Control Panel --> Keyboard --> Input Locale --> Add.

So it is the configuration for displaying multilingual text. Now we will start C# IDE and explore its features. Throughout the article we will only concentrate on the code written for multilingual features. The code for form creation, adding controls to form and event handling will be generated by the IDE and will not be discussed.

The first example is of Message Box. Create a Windows Application. Place a button in the centre of form. Set the name and text properties of the button to btnMessage and "Show Message" respectively. For displaying Message Box, add following code to the Click event of btnMessage.

protected void btnMessage_Click (object sender, System.EventArgs e)
    MessageBox.Show("English Text Example","English Title");

On Pressing F5, Form will be displayed and on clicking Show Message. Message Box will be displayed.

Messsage Box with English Text

Now for displaying Arabic text, type message and title using Arabic characters. The Message is " Urdu Text Example" and "Urdu Title" in Urdu Language.

C# Code for Urdu dispaly

The message box displayed by clicking Show Message Button will be

Messsage Box with Urdu Text

The Message box displays Urdu Text (in Arabic Script). but it has some problems. Arabic Script is written from Right to Left (The rightmost character is first character of string, and leftmost is the last character of string). So the text must be right aligned. In the above example both Title and Message are left aligned. Also the Title must be at right and the Close Button should be at left in a RightToLeft Scheme. This can be done by using style attributes as third parameter of MessageBox.Show method. Style Attributes are used to change the visual style and options of Message Box. For Example, for displaying a Cancel button with OK button, MessageBox.OKCancel is used as


For RightToLeft MessageBox, RTLReading field is used. And for right aligning the text, RightAlign field is used. So in our new example these two are ORed and passed to Show method of MessageBox (you can OR multiple fields to give their style to MessageBox).

C# Code for RightToLeft Display

Messsage Box with RightToLeft

In above examples, we use Windows 2000 support to insert Arabic (Urdu) characters to the code. But if the development environment does not have support for writing multilingual characters, then this work can be done by code. The character data type of C# stores characters as Unicode character. So we can declare variables of character and string type and assign characters and words of different languages to these variables.

In the next example, we will display word "Urdu" in Arabic Script in a textbox without using Arabic Keyboard of Windows 2000.

protected void button1_Click (object sender, System.EventArgs e)
    char aleph ;
    char ra;
    char dal;
    char wao;
    string word;
    aleph = '\u0627';
    ra = '\u0631';
    dal = '\u062F';
    wao = '\u0648';
    word = aleph.ToString() + ra.ToString()+dal.ToString()+ wao.ToString();
    textBox1.Text  = word;

Text Box with Urdu Text

During execution of the application, when we click on the button, word "urdu" in Arabic Script will be displayed in the textbox.

The word "urdu" in Arabic script consists of four characters: Aleph, Ra, Dal and Wao. So the Unicode values of these characters are stored in four variables. You can store any Unicode character in C# by giving its hexadecimal value as '\uXXXX'. Then next task is to concatenate these characters to have word. This is done by converting character to string (using ToString method). Finally the variable word( having Unicode string) is assigned to the text property of textbox. If Arabic Script support is installed on the system, then the word will be displayed in Right to Left direction.

The only problem with above code is that it is aligned to the right. All controls have a property RightToLeft. If this property is set to Yes, then not only text is displayed from Right to Left but also other features of controls have Right to Left direction. For Example, we place a ComboBox on the Form and add three items "Arabic", "Farsi" and "Urdu" (in Arabic Unicode Characters) to it.

Combo Box without RightToLeft

The Combo Box displays three words in Arabic Script but it does not have all Right to Left Features. In a Right To Left Control, all the words must be right aligned. Also the Dropdown Arrow must be at left of the control. Similarly if a control has vertical scrollbar then it must be at left of the control. This can be done by setting RightToLeft property of the control (e.g. our ComboBox) to Yes. After it, the output will be as desired.

Combo Box with RightToLeft

If RightToLeft property can have a third value Inherits. If a control has value Inherits then its RightToLeft value is same as of its Parent Control.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Tafseer Ahmed
Pakistan Pakistan
No Biography provided

You may also be interested in...


Comments and Discussions

QuestionWant to Convert text in local laguage. Help Pin
Onick Ahmed12-May-14 22:06
memberOnick Ahmed12-May-14 22:06 
SuggestionType / Write Urdu / Arabic / Farsi in C# and VB.NET Pin
Naseem_Amjad31-Aug-13 6:10
memberNaseem_Amjad31-Aug-13 6:10 
GeneralUnicode and textbox [modified] Pin
linye19-Feb-10 2:00
memberlinye19-Feb-10 2:00 
GeneralThank you Pin
babakzawari23-Jan-10 21:03
memberbabakzawari23-Jan-10 21:03 
QuestionCan we display OK button text in urdu Pin
rajender303517-Feb-09 0:06
memberrajender303517-Feb-09 0:06 
QuestionWhere you able to set the title to contain Urdu text? Pin
Lee Elenbaas26-Mar-08 7:45
memberLee Elenbaas26-Mar-08 7:45 
GeneralArabic Pin
Kwrapd4-Sep-07 19:39
memberKwrapd4-Sep-07 19:39 
GeneralUrdu language problem Pin
samtam28-Nov-06 23:41
membersamtam28-Nov-06 23:41 
QuestionRightToLeft MenuItems Pin
BaraaSh5-Mar-06 4:00
memberBaraaSh5-Mar-06 4:00 
GeneralHelp Pin
sreejith ss nair18-Sep-05 21:32
membersreejith ss nair18-Sep-05 21:32 
GeneralRe: Help Pin
saeed.darya15-Nov-06 20:29
membersaeed.darya15-Nov-06 20:29 
Generalwithout configuration changes Pin
Anonymous26-Apr-05 19:28
sussAnonymous26-Apr-05 19:28 
GeneralCorrect Code in MessageBox.Show to show Arabic Pin
alamir_mohamed1-Mar-05 3:18
memberalamir_mohamed1-Mar-05 3:18 
GeneralLanguage on Msg-Button Pin
Kuster Roli15-Sep-04 12:31
memberKuster Roli15-Sep-04 12:31 
GeneralRe: Language on Msg-Button Pin
mshoukry_alkhwarazmi26-Sep-05 4:25
membermshoukry_alkhwarazmi26-Sep-05 4:25 
GeneralMultilanguage over network Pin
Anonymous17-Apr-04 7:24
sussAnonymous17-Apr-04 7:24 
GeneralMultilingual Textbox Pin
ifigomla9-Sep-03 5:35
sussifigomla9-Sep-03 5:35 
GeneralRe: Multilingual Textbox Pin
Tafseer Ahmed10-Sep-03 21:03
memberTafseer Ahmed10-Sep-03 21:03 
GeneralRe: Multilingual Textbox Pin
Andrew Hamilton12-Mar-04 9:28
memberAndrew Hamilton12-Mar-04 9:28 
GeneralRe: Multilingual Textbox Pin
Anonymous27-Sep-04 17:45
memberAnonymous27-Sep-04 17:45 
GeneralRe: Multilingual Textbox Pin
sohailalikhan13-Mar-06 19:52
membersohailalikhan13-Mar-06 19:52 
GeneralRe: Multilingual Textbox Pin
Naseem_Amjad13-Mar-06 21:05
memberNaseem_Amjad13-Mar-06 21:05 
GeneralRe: Multilingual Textbox Pin
Pouriya.GH20-Sep-11 23:03
memberPouriya.GH20-Sep-11 23:03 
GeneralRight to Left Layout Form in C# Pin
A.Said5-Jul-03 22:24
memberA.Said5-Jul-03 22:24 
GeneralRe: Right to Left Layout Form in C# Pin
mimirshad4-Dec-07 21:12
membermimirshad4-Dec-07 21:12 
Generalwriting hebrew to text files Pin
Anonymous30-Mar-03 1:16
sussAnonymous30-Mar-03 1:16 
GeneralRe: writing hebrew to text files Pin
schuetz1-Feb-04 2:58
memberschuetz1-Feb-04 2:58 
GeneralalijafriHow Can I Install Arabic Support in Windows ME or Windows 98 Pin
asadalijafri17-Mar-03 19:35
sussasadalijafri17-Mar-03 19:35 
GeneralRe: alijafriHow Can I Install Arabic Support in Windows ME or Windows 98 Pin
alamir_mohamed1-Mar-05 2:20
memberalamir_mohamed1-Mar-05 2:20 
GeneralTextbox input accepting foreign characters Pin
hreinn agustsson25-Nov-02 13:34
susshreinn agustsson25-Nov-02 13:34 
QuestionRe: Textbox input accepting foreign characters Pin
RedSunBeer12-Jun-07 20:05
memberRedSunBeer12-Jun-07 20:05 
GeneralUse external language packs instead of DLLs for supporting multilingual Pin
Herman Kwan9-Aug-02 14:16
memberHerman Kwan9-Aug-02 14:16 
Generalhttp chat Pin
Anonymous6-Jun-02 1:52
memberAnonymous6-Jun-02 1:52 
QuestionMirroring Awareness with visual Studio.NET winforms applications..? Pin
Reva20-May-02 21:54
memberReva20-May-02 21:54 
AnswerRe: Mirroring Awareness with visual Studio.NET winforms applications..? Pin
Tafseer28-May-02 19:00
memberTafseer28-May-02 19:00 
GeneralRe: Mirroring Awareness with visual Studio.NET winforms applications..? Pin
Reva28-May-02 19:33
memberReva28-May-02 19:33 
GeneralUrdu text Pin
Haider Sayed26-Mar-02 9:05
memberHaider Sayed26-Mar-02 9:05 
GeneralUrdu Pin
Tariq Askari25-Dec-01 23:35
memberTariq Askari25-Dec-01 23:35 
Questionwhat if we want to use urdu characters Pin
S.S. Ahmed6-Nov-01 19:15
memberS.S. Ahmed6-Nov-01 19:15 
AnswerRe: what if we want to use urdu characters Pin
Anonymous6-Nov-01 19:44
memberAnonymous6-Nov-01 19:44 
AnswerRe: what if we want to use urdu characters Pin
Tafseer Ahmed6-Nov-01 19:45
memberTafseer Ahmed6-Nov-01 19:45 
GeneralRe: what if we want to use urdu characters Pin
S.S. Ahmed6-Nov-01 22:12
memberS.S. Ahmed6-Nov-01 22:12 
GeneralRe: what if we want to use urdu characters Pin
Tafseer Ahmed7-Nov-01 2:54
memberTafseer Ahmed7-Nov-01 2:54 
GeneralRe: what if we want to use urdu characters Pin
S.S. Ahmed7-Nov-01 3:34
memberS.S. Ahmed7-Nov-01 3:34 
AnswerRe: what if we want to use urdu characters Pin
Anonymous14-Mar-02 3:50
memberAnonymous14-Mar-02 3:50 
GeneralRe: what if we want to use urdu characters Pin
Ahsan Ullah Burki18-Jun-03 5:23
sussAhsan Ullah Burki18-Jun-03 5:23 
Generalinput from user Pin
sethaq28-Aug-01 10:40
membersethaq28-Aug-01 10:40 
GeneralMultiple Language Pin
Olaf Herrmann28-May-01 1:54
memberOlaf Herrmann28-May-01 1:54 
GeneralRe: Multiple Language Pin
Herman Kwan9-Aug-02 15:01
memberHerman Kwan9-Aug-02 15:01 
Generalno Pin
satya23-May-01 1:57
membersatya23-May-01 1:57 

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
Web01 | 2.8.161021.1 | Last Updated 19 Oct 2002
Article Copyright 2001 by Tafseer Ahmed
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid