Multilingual Applications - Switching Languages

Environment: Windows NT 4, Windows 2000

The support for multiple languages within one application has always been a drag, for NT 4.0 and Window 2000 I have fond a simple solution. Unfortunatley this does not work for Windows 95 or 98 :-(

1. Add all the resources (dialogs, strings, menues etc.) in all of the desired languages in your project.

2. Add a menu, or language selection dialog in your project which calls the code shown below.

3. Thats it.



   // switch language to german
   ::SetThreadLocal(MAKELCID(MAKELANGID(LANG_GERMAN,SUBLANG_DEFAULT),SORT_DEFAULT));
   ...
   // or back to english
   ::SetThreadLocal(MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_DEFAULT),SORT_DEFAULT));

History



Comments

  • This API is not present in eMbedded VC++

    Posted by Legacy on 08/07/2003 12:00am

    Originally posted by: Amit Shinde

    hi,

    this api is not present in evc++ so how can i implement this functionality.

    Reply
  • Don't you mean SetThreadLocale

    Posted by Legacy on 05/29/2003 12:00am

    Originally posted by: Will

    Don't you mean SetThreadLocale instead of SetThreadLocal
    It really bugs me when people don't post example projects.
    SORT IT OUT you fool

    Reply
  • Easy way for switching languages with DLLs

    Posted by Legacy on 06/27/2001 12:00am

    Originally posted by: Robin Holenweger

    Hi

    In my last project I was responsible for GUI development and NLS. I've found another way. The only disadvantage is, that you have to buy another software: a so called "localization tool".
    What I did is to extract all resources into a DLL which can be loaded at runtime (on-the-fly). So it's possible to load any language specific resource DLL at any time to change the language. No modifications to other code than just unloading the current and loading the new DLL.
    Advantages:
    - you only have to make a resource change once, e.g. if you change a dialog, you don't have to do this change in all other languages. Just generate the new DLLs
    - it's easy to give a text file or excel sheet to a translator and to use these files as a glossary to generate destination DLLs.
    - often there exist the possibility in these tools to autotranslate

    For those who don't want to buy another software: it's also possible to modify the DLLs with Visual Studio but then it's almost the same as in this article.


    • Multilingual application.

      Posted by purish87 on 04/08/2009 02:18am

      Your solution is quite interesting. Can u provide any sample application for help? Is there any way to change the text of Afxmessagebox() using this?

      Reply
    Reply
  • Multilingual Applications - Switching Languages

    Posted by Legacy on 12/16/1999 12:00am

    Originally posted by: Peter Boenigk

    Es will nicht funktionieren, haben Sie Bitte evtl. ein
    Programmbeispiel

    Reply
  • Changing language in Windows 9x

    Posted by Legacy on 06/22/1999 12:00am

    Originally posted by: Pierre Couderc

    Ok, it is impossible.

    The way we have found is to change in the registry HKEY_USERS,".DEFAULT\\Control Panel\\Desktop\\ResourceLocale"

    which is filled with a MAKELANGID()

    Changed there, it seems to keep the new language after... a reboot of Win9x.

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

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: October 29, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT It's well understood how critical version control is for code. However, its importance to DevOps isn't always recognized. The 2014 DevOps Survey of Practice shows that one of the key predictors of DevOps success is putting all production environment artifacts into version control. In this eSeminar, Gene Kim will discuss these survey findings and will share woeful tales of artifact management gone wrong! Gene will also share examples of how …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds