The Language Overview described how LoadResString() can look in and EXE/DLL for a string identifier and return the corresponding string. The third parameter to LoadResString() can be a handle or a string, giving us two ways to use it:
// METHOD 1
cLanguage := "APP-FR.DLL"
cText := LoadResString("Default application",ID_MYAPP,cLanguage)
// METHOD 2
hLanguage := LoadLibrary("APP-FR.DLL")
cText := LoadResString("Default application",ID_MYAPP,hLanguage)
Because LoadResString() will be used widely throughout your application, and each time it will need to reference the appropriate language DLL, you should consider how make that name/handle available throughout your code. One solution is to use a GLOBAL variable to hold its value, another is to make an instance variable of your main window to keep track of it.
Once you have a reference to your language DLL available you can use it in all of the LoadResString() calls.
Example
Continuing the mulitlingual version of the Standard MDI application example from the previous topic:
1. Create a GLOBAL variable in Standard MDI app
GLOBAL gpLanguage AS PTR
2. In the App:Start() method use LoadLibrary() to load the appropriate language DLL:
METHOD Start() CLASS App
LOCAL oMainWindow AS StandardShellWindow
LOCAL cLanguage AS STRING
// This assumes the registry has been used
// to store the selected language
cLanguage := QueryRTRegString("Standard MDI","Language")
IF Empty(cLanguage)
cLanguage := "StdMDIEN.DLL"
ENDIF
gpLanguage := LoadLibrary(cLanguage)
SELF:Initialize()
oMainWindow := StandardShellWindow{SELF}
oMainWindow:Show(SHOWCENTERED)
SELF:Exec()