Click here to Skip to main content
11,410,365 members (55,865 online)
Click here to Skip to main content

Multilingual support for applications

, 7 Jun 2005
Rate this:
Please Sign up or sign in to vote.
An easy solution to add multilingual support to your application in 10 minutes.

Why another article about multilingual applications?

Well, about a year ago, I needed my application to support multiple languages. I thought it would be very easy to find out how to do this. There are a lot of articles that explain how to do this, but none of them fit my needs.

What can I find here?


What I really needed were simple .h and .cpp files which are able to load a language DLL and extract the strings I need. None of the articles I found provided this. At this point, I decided to write my own classes which could do the task I wanted them to do. I am a little active on some forums, and I see this question keeps coming back of how to implement multiple languages to an application. What I see is that it is really hard to understand how it works, the first time. So I decided to write a little article and add my language files to CodeProject.

How to use?

I tried to implement the files so that they are really easy to use. Let's explain how the class works.

Use string tables

Some people are still hard-coding the strings of their application in their code. This isn't the best solution on earth. So use string tables, because this is needed if you want to add multiple language support to your application.

Add files to project

First of all, you have to add the files Language.cpp and Language.h to your project. Now you are almost ready adding multilingual support to your application. The class I developed is a so-called singleton class. This means that you don't have to create the class every time. You only have to load and release the language at startup, and you can use the class everywhere.

How to load a language

Now, you are ready to load your first language. Normally, you load language at the startup of your application. Here is some example code that will try to load the system's default language:

BOOL CMyApp::InitInstance()
    .. some default code here

    // Init language object 
    CLanguage * pLanguage = CLanguage::Instance(); 

    // If you want, you can init the location of the dll's and the default language
    pLanguage->Init("lng", "dutch");

    // Load system default language 
    if (!pLanguage->LoadLanguage(GetSystemDefaultLangID())) 
        // Show error
        AfxMessageBox("Unable to load system language, "
                                  "default language is used");

    // Load dialog
    CMyDialog dlg;
    // Release language

    .. rest of code

It was pretty easy to load a language, wasn't it? Keep in mind that the Init function is not really needed. If you don't call this function, the defaults "lng" and "english" are used. But this is not all, you also have to load the strings.

How to load strings

You have loaded a language, but you also want to load strings. For example, you have a dialog with a nice static control. This is how you load the language:

BOOL CMyDialog::OnInitDialog()
    // Call original function

    // Init language object
    CLanguage * pLanguage = CLanguage::Instance();

    // Set text for static control

    .. rest of code

The language object will see if the user has loaded a valid DLL. If so, the string will be loaded from the DLL, if not, the default string table will be used. Still easy isn't it? That is all you have to do in your application.

How to create the language DLLs

There are a few easy steps to take:

  1. Create project.

    First, you have to create a project for your DLL. Start Visual Studio, and choose File -> New.... Then select Win32 Dynamic-Link Library. Give your project a new name and click OK. You now have seen a wizard, select a DLL that exports some symbols. The default files for the DLL are now created.

  2. Copy string table from original project.

    Now the default files are created, close the current (language DLL) project. Open your real application in the IDE now and open the string table. Use CTRL + A to select all items and then copy them. Close project again.

  3. Add string table to language project.

    Open your language project again. Select File -> New... and select resource script. Give the resource script a name and click OK. Now you can add resources to your project. Right click on the resource file and select Insert..., then select String table. Now copy the string table of your application to the language DLL (just use CTRL + V). As you will see, all values are now in the language DLL. You can start translating all the sentences now. If you are ready, you can compile the project. The DLL is now ready to use!


There are a lot of languages automatically supported by the language class. Of course, you can edit these settings yourself in Language.cpp (see InitLanguages function). A list of languages supported and the name of the DLL which is expected is given below:

Language DLL ID Code Language description
arabic.dll unknown - -
chinese_simplified.dll unknown - -
czech.dll 0x0405 CSY Czech
danish.dll 0x0406 DAN Danish
dutch.dll 0x0413
Dutch (Standard)
Belgian (Flemish)
finnish.dll 0x040b FIN Finnish
french.dll 0x040c
French (standard)
german.dll 0x0407
German (standard)
greek.dll 0x0408 ELL Greek
hungarian.dll 0x040e HUN Hungarian
icelandic.dll 0x040f ISL Islandic
italian.dll 0x0410
Italian (standard)
lithuanion.dll unknown - -
norwegian.dll 0x0414
Norwegian (bokmal)
Norwegian (nynorsk)
polish.dll 0x0415 PLK Polish
portugues_br.dll 0x0416 PTB Portuguese (Brazilian)
russian.dll 0x0419 RUS Russian
slovak.dll 0x041b SKY Slovak
spanish.dll 0x040a
Spanish (standard/traditional)
Spanish (modern)
swedish.dll 0x041D SVE Swedish
turkish.dll 0x041f TRK Turkish


  • June 3rd, 2005
    • Updated source code, constants can be changed at run-time;
    • Updated source code, you don't have to link to libraries anymore;
    • Removed MFC version, Win32 version will work in MFC applications;
  • June 1st, 2005
    • Added example application;
    • Added MFC and non-MFC versions;
    • Fixed bug when including multiple files;
  • May 26th, 2005
    • First release.


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

Geert van Horrik
Software Developer CatenaLogic
Netherlands Netherlands
I am Geert van Horrik, and I have studied Computer Science in the Netherlands.

I love to write software using .NET (especially the combination of WPF and C#). I am also the lead developer of Catel, an open-source application development framework for WPF, Silverlight, WP7 and WinRT with the focus on MVVM.

I have my own company since January 1st 2007, called CatenaLogic. This company develops commercial and non-commercial software.

To download (or buy) applications I have written, visit my website:
Follow on   Twitter

Comments and Discussions

GeneralIt's good! I have used this Class in my application to support simple Chinese, which language code is 0x0804. -- Thanks. PinmemberDaniel.Li1-Nov-09 16:54 
QuestionWill Japanese string supported? PinmemberVamsee_Krishna4-May-08 21:10 
QuestionWill your application support chinese or japanese literals ? Pinmemberganesa moorthy3-Apr-08 20:49 
AnswerRe: Will your application support chinese or japanese literals ? PinmemberGeert van Horrik3-Apr-08 20:53 
GeneralOverkill solution PinmemberKarstenK1-Oct-07 2:36 
QuestionWhy re-enventing the wheel again and again? Pinmemberlocalizer4-May-06 5:35 
GeneralCopy string table fails !!! Pinmemberjack2000de27-Feb-06 7:09 
GeneralRe: Copy string table fails !!! PinmemberGeert van Horrik27-Feb-06 7:53 
GeneralRe: Copy string table fails !!! Pinmemberjack2000de27-Feb-06 22:31 
GeneralRe: Copy string table fails !!! PinmemberGeert van Horrik28-Feb-06 1:08 
GeneralHelp Pinmembersreejith ss nair18-Sep-05 22:31 
Good Article.

I have a small doubt regarding Globalization/Localization. Hope you can help me out.
I have a web form application where i need to provide more than 50 different localized resource supports. Apart from this, my application supports rich use of stored data (Sql Server Database) and obviously have few list of Listing controls (Repeater , Grid etc).

My requirement comes like this,

a) I need to provide full localized language support in all data which is displaying in each and every page. Regardless of, the name of controls, content of controls etc. To be concise, which ever text that i am displaying through page, need to be localized based on user selected language.

b) Each and every setup needs to contain all supported languages. So user can switch and view content of site in different language.

I stuck in,

1) I am not sure how to localize stored data in database.
2) How will I give or from where i generate localized information for all supported language.

It would be grate if you can help me out through your valid comments.

Sreejith Nair
[ My Articles ]
GeneralRe: Help PinmemberGeert van Horrik19-Sep-05 0:09 
GeneralRe: Help Pinmembersreejith ss nair20-Sep-05 20:35 
GeneralRe: Help Pinmembersreejith ss nair20-Sep-05 20:35 
GeneralMultilingual support for application Pinmembergeoyar25-Jun-05 13:29 
GeneralRe: Multilingual support for application PinmemberStarlightNo127-Jun-05 9:36 
GeneralEasier way: few code changes and languge resource-only DLL. Pinmemberyuhaian20-Jul-05 11:22 
GeneralGood work ! Pinmemberunionize21-Jun-05 8:09 
GeneralA what about menu ?! PinsussFredy Pumpicka16-Jun-05 23:52 
GeneralRe: A what about menu ?! Pinmemberdisabledman19-Jul-05 21:27 
GeneralAnother another approach PinmemberEzioXia6-Jun-05 1:46 
GeneralRe: Another another approach PinmemberGeert van Horrik6-Jun-05 2:06 
GeneralRe: Another another approach PinmemberDimitris Vassiliades14-Jun-05 0:25 
GeneralRe: Another another approach PinmemberGeert van Horrik13-Jun-05 21:33 
GeneralHere is "Another approach" Pinmemberyuhaian20-Jul-05 11:30 
GeneralRe: Another another approach PinmemberHeartFriend7-Sep-05 21:37 
GeneralThe right way to do it PinsussAnonymous1-Jun-05 21:07 
GeneralRe: The right way to do it PinmemberGeert van Horrik1-Jun-05 21:35 
GeneralRe: The right way to do it PinmemberVLarin1-Jun-05 23:42 
GeneralRe: The right way to do it PinmemberMihai Nita2-Jun-05 20:08 
GeneralRe: The right way to do it PinmemberGeert van Horrik3-Jun-05 1:59 
GeneralRe: The right way to do it PinmemberBlake Miller2-Jun-05 7:53 
GeneralRe: The right way to do it PinsussNat pear23-Jun-05 1:01 
GeneralHow about this way. Pinmemberyuhaian20-Jul-05 11:35 
GeneralAnother approach PinmemberVLarin1-Jun-05 3:36 
GeneralRe: Another approach PinmemberBlake Miller2-Jun-05 7:32 
GeneralRe: Another approach PinmemberVLarin3-Jun-05 0:56 
GeneralMultiple defined symbols! PinmemberBob Stanneveld31-May-05 11:04 
GeneralRe: Multiple defined symbols! PinmemberGeert van Horrik31-May-05 21:31 
QuestionIs there any way to operate with other resourses? Pinmemberdim1330-May-05 4:01 
AnswerRe: Is there any way to operate with other resourses? PinmemberGeert van Horrik30-May-05 7:18 
GeneralRe: Is there any way to operate with other resourses? PinmemberBlake Miller2-Jun-05 7:22 
GeneralRe: Is there any way to operate with other resourses? PinmemberGeert van Horrik2-Jun-05 21:13 
QuestionGreat works, But can you do it without MFC? PinmemberRocom26-May-05 19:35 
AnswerRe: Great works, But can you do it without MFC? PinmemberGeert van Horrik27-May-05 19:31 
GeneralRe: Great works, But can you do it without MFC? PinmemberRocom1-Jun-05 16:26 
QuestionHow about Chinese? Pinmemberli000026-May-05 18:22 
AnswerRe: How about Chinese? PinmemberGeert van Horrik27-May-05 19:30 
GeneralRe: How about Chinese? Pinmembermn_guy17-Oct-06 5:17 
GeneralRe: How about Chinese? PinmemberGeert van Horrik20-Oct-06 0: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.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150414.5 | Last Updated 7 Jun 2005
Article Copyright 2005 by Geert van Horrik
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid