Giving the user a language option in VC++??

Hello,
Could any one please explain how it is possible to give the user the option to change the language of the status bar,main frame etc during runtime I create a dialog box in an SDI based MFC-application(using Visual Studio dot net 2003) and have a list box in the dialog box,with language options such as "English","French","German" etc.The default language is english,but if the user selects German,then on pressing ok the language should change to german.
I heard it can be done by using "String resource".A little detailed explanation would be highly appreciated.
Thank you



Answer this question

Giving the user a language option in VC++??

  • Freem0n

    Yes you have to translate the resources by yourself. We use RCWinTrans as a tool (very good)!

    Sorry I never had time to write this article in english. May be some times...



  • Jeffrey Odell

    The resources do have an option saying Language,but the language in which the menu etc is written is english even though the property language combo box says Deutsch(Deutschland).
    Do we have to convert each word from english to German ourselves for the menu caption etc
    Your article seems very intzeresting and useful,but my german is not good,so it would be nice if you could send a link for the english version(if it exists).
    Thanks a lot


  • KristiLM

    Hi Martin,
    Thanks for the steps,
    A small problem: the copies of the resources I create remain in the same language as the original resource.I am using the english version of Visual Studio-2003 dot Net,but my OS is Win XP German version.
    My resources originaly are in english,but if I make a copy of them in German(or French or any other language),the copied(new) versions are also in English.Any idea why this is so
    Thanks a lot



  • Mandeep Singh

    Hi,
    I had a look at the discussion provided by you,but am still confused.
    I have followed the steps and created a copy of all resources(such as mainframe,dialogs etc) in german and english(U.S.),but dont know how to proceed further.
    May I request you to kindly detail the steps required to change the language of status bar,mainframe,etc etc to German from English.I would be extremely grateful to you.
    Thank You


  • Wayne Arant II

    Do you have different DLLs for each language now

    If not create empty DLL projects add the resource file to it. Define AFX_RESOURCE_DLL and a define for the language AFX_TARG_...

    Load this DLL at program start in InitInstance and call AfxSetResourceHandle()!

    Switching the language at runtime is much to complicated and I don't remember all the location you have to hack.



  • vc1234

    The best way is to have one Resource DLL for each language. With AfxSetResourceHandle you can influence what resources will get loaded. The main problem are the menus and the docuent templates, that are loaded directly in the startup and never reloaded.

    From my point of view it is not a problem to say, "please restart the application" when the user switches the language. Thats the way we do it. Usually the user switches it once and than uses it in this way..



  • knox_tenor

    You can insert copies for each resource.
    In the resource view, right click on the resource, like for example string table, and choose "Insert Copy..." menu item. Then, in the "Insert Resource Copy" dialog choose the desired language.

    To change at run-time the resources for a given language, you can try call SetThreadLocale.
    But I warn you that may experience, depending on the OS, unpleasant surprises, even you call it before all others in your application's InitInstance function.
    Take a look at this discussion.

    However, you may not need that, as long as there is a control panel regional settings option, which will "force" the application to use the appropriate resource copy, if exists.



  • Kylelanson

    Check the properties for the resources you can change the language there with a combo box.

    If you are using a german OS you migth be able to read this article. from me:

    http://www.mpdvc.de/artikel/MultilingualeProgramme.htm



  • Giving the user a language option in VC++??