The runtime switched versions of your apps that VBLM builds have three basic requirements:
1. The relocation of strings from your source code to a database or resource file
2. The replacement of strings in code with calls to a function that returns a string from the database or resource
3. Additional support code, including but not limited to the string replacement function and a means of selecting the language to use.
VBLM meets the first requirement by building the language database, the second by modifying your source code, and the third by copying selected RSV support files into new project builds. Although 1 or 2 RSV support files are included in any given project, over 20 different ones are supplied with VBLM and installed into the VBLM\Support Files subdirectory. You can also create your own from scratch, and/or modify those supplied.
Selection Criteria
The specific files selected for inclusion in a particular project depend on several things:
the version of VB the parent project is written in
the type of project
the language database format
whether runtime dimension switching is implemented
You (VBLM suggests files based on the above, but you can always override them)
Each supplied file provides support for some configuration of these factors, and most selection criteria are straightforward: a file either supports dim switching, a particular version of VB, or a specific database format, or it doesn't. Interaction between project type, language selection, and a possible installation strategy, however, makes things a little more interesting. Consider language selection for multilingual builds of the following language manager projects (*.LMP):
Project1 is based on a single VB project which compiles into an EXE file. When the localized version executes, it pops up a window with a list of languages and asks the user to select one. Thus it needs a language selection form in addition to the module with the string replacement function.
Project2 is based on a VB project group consisting of one EXE and several DLLs. When the EXE starts, it pops up a window with a list of languages and asks the user to select one. It then records this choice in the registry. When any of the DLLs are called, they read the language selection from the registry. The EXE project needs a language selection form and a support module that writes to the registry, while the DLLs need no form, but a support module that reads from the registry.
Project3 is a project of any type using an ANSI text or binary format language database (LDB) that can speak 8 different languages. Instead of building a single LDB containing all 8 languages, however, the developer builds 8 separate databases, one for each language. The installation program asks the end user to select her preferred language and installs the corresponding database. With only one language in the LDB, there is no need for the app itself to support language selection, and it will load and use the only one available without asking the user anything.
In Project1 and Project2, project type maps to the registry functions of a given support file and determines whether a language selection form is needed. Project3 is an example of where you would override VBLM's selections (and also an example of where you'd need to do a little customizing of the support module).
Automatic File Selection
VBLM has an RSV support file selection algorithm that takes all of these factors into account. The algorithm is called whenever a new project is created, and again (unless you tell it not to) whenever you change the LDB format or turn runtime dimension switching on or off:
Underlying automatic selection is a master list of RSV support files maintained by VBLM. Each entry on the master list includes a fully qualified filename and an encoded description of file type, what versions of VB and what LDB formats it supports, its registry functions, and whether or not it supports dimension switching. You can add and delete files by editing the master list.
The selection algorithm iterates through the list looking first for an appropriate support module for the current project, and selects the first one that it finds (if there is more than one file on the list that would do the job, the first one found is always selected). If the project type calls for a language selection form, the algorithm then takes a second pass to find one.
Note 1: On the fly switching requires a single small procedure in the support module. When on the fly switching is active, VBLM appends this procedure to whichever support module is selected and copied during the build.
Note 2: Projects that store strings in a resource also require a small build-specific procedure in the support module, to return the list of languages included in the resource. VBLM will likewise append this procedure to whichever support module is selected and copied during the build.
Note 3: In the collection of support files supplied with VBLM, the only differences between the language selection forms are their VB versions. LDB format, dim switching, and registry functions are irrelevant to the choice of forms, as they contain no related code and support any configuration of these options.
Viewing and Changing Selected Files
To view the results of the selection process, click the Runtime Switching Support Files node. on the Build window. The resulting display shows the selected files on the left (the checked ones) and describes the highlighted one on the right. To overriding the selections, uncheck VBLM's choices and check your own.
See Also
Editing the Master List of RSV Support Files