Using LangAgent in your projects
You should use the LSTR macro with all text messages you want to localize. Mind, that not every string should be localized. For example, file names or registry key names normally should not be translated. So, you have to review every string.
Mind, that the source files scanner is very simple in the current version and does not allow you to use strings that span over two or more lines with the LSTR macro. Thus, the LSTR macro should be located on a single line. A line may contain multiple LSTR macros. Avoid using ambigious phrases in the LSTR macros which can be translated in several ways. Keep in mind, that some languages have declinations and conjugations. The endings of adjectives can depend on the gender of a noun.
Here are the instructions how to integrate LangAgent into your project. We recommend you to review the sample projects that come with LangAgent.
Complex product that consists of several projects inside (EXE and DLLs)
Here is the information how to integrate LangAgent into your application. Please, note that we provide a LangAgent Add-in for Developer Studio 6.0 that automates this process.
How to implement the language selection menu:
That's all!
In general do the same as above. However, since DLL has no standard user interface, you should implement the language selection manually. Use the LaSetCurrentLang, LaGetLangCount, LaGetLangName and LaGetLang functions. If you are going to use the resulting DLL/COM/ActiveX together with an application that also uses LangAgent, please review the following section carefully.
If your software product consists of several subprojects (the main program and one or several .DLL/.OCX) and you are going to use LangAgent in two or more subprojects, you are to:
You can use LangAgent in a non-MFC application. You should manually implement the Language selection menu (use the LaSetCurrentLang, LaGetLangCount, LaGetLangName and LaGetLang functions). Mind, that you have to pay special attention to the resource strings. LangAgent can only translate the resource strings loaded using the MFC AfxLoadString function. In a non-MFC application you should handle them as follows:
LoadString(hInst, ID_MYSTRING, StrBuffer, sizeof StrBuffer);
LPCTSTR translatedStr = LaGetStr(StrBuffer);
// use translatedStr
You can adjust the LangAgent behavior using the LaInit function parameters. For instance, you can disable some languages in the application, specify the desired language order, use the message file encryption and so forth. Please, refer to the Run-time reference for more details.
LangAgent translates string resources, menus and dialogs only. Other resources are left untranslated. So if your application use language-specific icons, bitmaps, toolbars, WAVs, AVIs you should handle them manually. Please, bare in mind, that the current LangAgent version does not handle the HTML files (the support for HTML is being developed).