devxlogo

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.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist