Changing an ESL program so it can dynamically change languages displayed to the user involves some additional work beyond what is required to externalize strings. Once the user has chosen the language to change to and the program has determined the name of the appropriate external string resource DLL, the following code does most of the work.
call EslXstrSetPrimaryDLL(LanguageDLLName_SV)
if (errorlevel = 0) then
use "xsrefresh" # Update displayed windows
# Update any variables or objects which are
# not automatically changed, but need to
# have text in the current language.
else
# Cannot load the DLL, tell the user.
end if
The ESLLIB subroutine EsIXstrSetPrimaryDLL loads the new DLL and updates all string literals and constants so they will use the values from the new DLL. This subroutine does not change any windows.
The action statement use "xsrefresh" updates the text displayed in regions and controls after the external string DLL has been dynamically changed. All regions and their children are refreshed as long as their text has not been changed since they were defined. The default is to refresh all regions and controls, but an object name may be specified so only that object and its children, if any, are refreshed.
All controls use the current external string values when their parent is made permanent or visible. Thus, any dialog region or dialog box that is temporary and invisible does not need to be refreshed.
Any object or menu item whose text or title bar has been modified by the change text statement will not changed by a xsrefresh statement. Those objects can be updated by repeating the statements used to set their text.
See EsIXstrSetSecondaryDLL ESLLIB Subroutine in the Reference Guide. This routine can be useful when only a subset of the external strings need to be changed, such as for a dialect or for a different kind of user.