On-The-Fly UI (User Interface) Language Changing

Environment: VC++.NET on Windows XP

Dear Reader,

Hello! Many people have sent me messages asking about how to make language DLL's and so on and so forth. But, if you are looking for a quick and easy solution, why not give this a whirl? This is just one example of how to change the interface's language on-the-fly. There are many, many ways to do this, so don't think I'm giving a "this is the only way to do it" tutorial. I just want to broaden your mind.

The "insane" demo includes some other interesting things, such as how to change your menus, tooltips, statusbar text, and so forth dynamically at runtime. I think that I've gotten most of the bugs worked out of it. Anyway, here it goes! It's gonna be a rocky ride, but just bear with me! Hope you can follow!

From, Omoshima

P.P.S. BTW, I'll soon be uploading a tutorial based around DLLs.

Vague, Hard-To-Follow Instructions (hopefully not!!)

  1. First and foremost, you must add the "LangIni.h" and "LangIni.cpp" files to the project.
  2. Then, add a variable to your C****App class.
  3. In your C****Dlg::OnInitDialog() function, call (or not) a function to set up all the buttons/texts in your dialog. I called mine "InitControls".
  4. void C****Dlg::InitControls(void)
  5. Then, add handlers for ON_BN_CLICKED for the radio buttons.
  6. void CUILangDlg::OnBnClickedPromptEnglish()
    // TODO: Add your control notification handler
    // code here
    void CUILangDlg::OnBnClickedPromptJapanese()
    // TODO: Add your control notification handler 
    //code here


Download the easy demo's source - 20.5 KB (21,029 bytes)
Download easy demo - 174 KB (178,778 bytes)

Download the insane demo's source - 34.9 KB (35,779 bytes)
Download insane demo - 205 KB (210,689 bytes)


  • Yes, but...

    Posted by Legacy on 09/08/2002 12:00am

    Originally posted by: omoshima

    Well, this isn't meant to be used... i just wanted to show one way. but, thanks for pointing out the issue. people should know about them:)


  • OK but...

    Posted by Legacy on 09/06/2002 12:00am

    Originally posted by: Philippe Lhoste

    I tried the demo on NT 4 sp 5 + IE4's new shell (Active Desktop).

    First, system complained about a missing file. It was oleacc.dll, I located it on the Net and with it, it ran fine. I think it is a common plague for applications compiled with VC++7.

    Second, as I failed to put the ini files in a Lang sub-directory, the program correctly complained about missing them, but made the switch anyway. It resulted in blank texts... A bit disturbing, you should have more robust error handling. Also you probably should load dynamically the list of languages from the content of this directory, instead of hard-coding it.

    Third, when I switched to Japanese, I got strange characters (ƒtƒ@ƒCƒ‹(&F) •ҏW(&E) •\Ž�(&V) Œ�Œ� ƒwƒ‹ƒv(&H)) instead of Japanese chars. That's because I use Comic Sans as menu font. I have Japanese fonts installed, they were not used. I don't know if it is simple to handle.
    Oh well, I suppose that this setting is mostly used on Japanese system, and so there is no problem here. Just wanted to mention the issue.


  • good

    Posted by Legacy on 08/24/2002 12:00am

    Originally posted by: anonymous

    you did a wonderful job
    it's what i am looking for

  • Good Article, Bad Comments

    Posted by Legacy on 08/20/2002 12:00am

    Originally posted by: Jim Groffen

    I enjoyed the article and assumed that when you said you would be working on a DLL tutorial that it would be for switching lang resources. It takes a long time to write an article well and I enjoyed this one. I guess some people can only take the time to be critics and not contributers.

  • Using external language packs instead of DLLs

    Posted by Legacy on 08/17/2002 12:00am

    Originally posted by: Herman Kwan

    Well, there're three main methods for supporting multilingual in Windows platforms:

    Method 1, Independent release for each language (e.g. Microsoft Windows)

    Method 2, Single executable file includes more than one language resources, or independent resource .dll file for each language (e.g. IsoBuster)

    Method 3, Single executable file with external language packs (e.g. Tweak-XP, PatchWise Free)

    Just like Netants, FlashGet, Tweak-XP, PatchWise Free, etc. More and more applications use external language packs (*.ini or *.lng) instead of DLLs for supporting multilingual. It's not necessary to recompile the whole project because the language packs can be added or modified dynamically. Absolutely, it's easy to translate and maintain the external language packs which are just like an INI-like text file. And, language can be shifted on the fly.

  • Excelent!!

    Posted by Legacy on 08/15/2002 12:00am

    Originally posted by: Anonymous

    Nice tutorial!!

    Indeed not the only sollution... but the only one here.
    >> If anyone else has some thoughts please post them. <<

  • Missing Source Code?

    Posted by Legacy on 08/13/2002 12:00am

    Originally posted by: Munish

    The source code is missing. Both the zip files only contain EXEs and INIs. No source files!!?
    Can you upload the source also?

  • MSDN example

    Posted by Legacy on 08/13/2002 12:00am

    Originally posted by: Wang

    Have a quick look on my MSDN, Noticed that there is a good artical in April 1999 issue of MSJ. It also comes with sample source code. The artical is celled "Design a Single Unicode App that Runs on Both Windows 98 and Windows 2000"

  • Another example of reinventing the wheel

    Posted by Legacy on 08/13/2002 12:00am

    Originally posted by: Andrew White


    The code is OK, if not fairly simple - but why do people
    keep on writing such functions?
    I mean there are 3 trillion packages on the market that
    do the same job and most of all better!
    1) What happens with right to left languages?
    2) What happens (as someone said) when the text becomes too long?
    And increasing the width of the caption will cause it
    to go over the screen's edge?
    3) Is an ini-file really a nice way of translating words?
    i.e. how do I find all words which have not been translated.
    How can I make sure that I have a kind of base lexicon
    (so that i don't translate "Ja" with "Yes" in one part of
    the code and with "Yeah" in another part.
    4) I have to put in extra source code in all my programs
    I would recommend using something like Multilizer (www.Multilizer.com)

    Andrew White

  • I wouldn't use this in all languages

    Posted by Legacy on 08/12/2002 12:00am

    Originally posted by: Ben Hooper


    Great idea, and really fast to get off the ground. However you will hit massive problems with some languages when they use 15 words when 3 will do. You dlg will look so horrible and nothing will fit properly. The way I have done it is to produce a separate resource DLL. Then your dlg layouts etc will always fit.

  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • When it comes to desktops – physical or virtual – it's all about the applications. Cloud-hosted virtual desktops are growing fast because you get local data center-class security and 24x7 access with the complete personalization and flexibility of your own desktop. Organizations make five common mistakes when it comes to planning and implementing their application management strategy. This eBook tells you what they are and how to avoid them, and offers real-life case studies on customers who didn't let …

  • On-demand Event Event Date: April 22, 2014 Database professionals -- whether developers or DBAs -- can often save valuable time by learning to get the most from their new or existing productivity tools. Whether you're responsible for managing database projects, performing database health checks and reporting, analyzing code, or measuring software engineering metrics, it's likely you're not taking advantage of some of the lesser-known features of Toad from Dell. Attend this eSeminar with Dell Software's …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds