Click to See Complete Forum and Search --> : Multilingaul Apps


April 14th, 1999, 10:45 AM
Hi,
I want to change the Text of Menu items ,Dialog
Box items at run time i.e make my app multilingaul
Does anybody knows how i can do it.

Thanks in Advance

-Yogesh

Paul McKenzie
April 14th, 1999, 11:32 AM
1) Create a resource-only DLL. This is a DLL that contains virtually no C++ code, only the strings that you want to make multilingual stored as string resources. Each string will have a unique ID (usually IDS_xxx). The ID is how you will identify each of the strings.

2) Load the resource DLL at runtime using LoadLibrary(). When you want to use one of the multilingual strings use LoadString()

Ex:
LoadString(hInstance, IDS_CLICK_HERE, ...)

where IDS_CLICK_HERE is the ID of the string "Click Here" in the resource DLL.

3) Once you get 1) and 2) working OK, create other resource DLL's exactly the same way, except that the strings in each one will be Italian, French, German, whatever. You'll end up with ITALIAN.DLL, FRENCH.DLL, GERMAN.DLL, etc. Using the same resource ID's as you used in step 1, but the strings will be foreign versions.

3) Develop a scheme (maybe an INI setting or create registry values) where the correct language DLL will be loaded. There are various ways of doing this, so you need to tailor how you want your program to know which language to use. Once your program determines the language that your user wants to use, just call LoadLibrary(szLangToUse), where szLangToUse is the language DLL to use. The LoadString(hInstance, IDS_CLICK_HERE,...) will still work, and will load the "Click Here" string in either Italian, French, German, etc.

The issue with the menus can be resolved by placing the menus in the resource-only DLL(s) also. When the application starts, Load the resource DLL, and use LoadMenu() and SetMenu() to attach the menu to your application's main window.

Good Luck

Regards,

Paul McKenzie