Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Expertise: Beginner
Mar 21, 2003

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.
Paul Marinescu
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.