Translate Your Program Easily

Translate Your Program Easily

If you want your program to be easily translated into a different language, consider making every displayed text a resource in a dll. Every language will have its own .dll and the same text will have the same id in all dlls. Then, all you have to do at runtime is to load the right dll and get the text resources with the LoadString API:

 LPSTR szLang;	//this will contain the language that should be used-----------------------------------------char szWindowTitle[256];wsprintf(szDll, "%s.dll", szLang);HMODULE hDll = LoadLibrary(szDll)LoadString(hDll, IDS_WINDOW_TITLE, szWindowTitle, sizof(szWindowTitle));-----------------------------------------

You should have several dlls: ‘eng.dll’, ‘fr.dll’, ‘it.dll’ ?one for each language you support.


Share the Post: