Visual Basic Concepts
It is a lot more efficient to design your application with localization in mind, following an approach that separates string resources from code, than to revise your finished application to make it international later in the development process.
There are four primary advantages to designing and implementing your Visual Basic application so that it is sensitive and appropriate to international conventions, foreign data, and format processing:
Any application that will be localized represents two conceptual blocks: a code block and a data block. Figure 16.1 represents the data block as the "user interface component" and the code block as the "application component."
Figure 16.1 The data block and code block make up a localized product
The data block contains all the user-interface string resources but no code. Conversely, the code block contains only the application code that is run for all locales. This Visual Basic code handles the string resources and the locale-specific settings. "Writing International Code in Visual Basic" provides details on how to write Visual Basic code that handles locale-specific settings, such as dates, currencies, and numeric values and separators.
In theory, you can develop a localized version of your Visual Basic application by changing only the data block. The code block for all locales should be the same. Combining the data block with the code block results in a localized version of your application. The keys to successful international software design are the separation of the code and data blocks and the ability for data to be accurately read by your Visual Basic application, regardless of the locale.
Although it may be more work for the person writing the Visual Basic application, no user-interface elements should be present in the Visual Basic code. Instead, the string resources should be placed in a separate file, from which they will be loaded at run time. This file is called a resource file (.res), which is a file that contains all the strings, bitmaps, and icons that are localized. For more information about resource files, see "Using Resource Files for Localization" later in the chapter.
The teams working on localizing the application should work exclusively on the resource file to develop all the different language versions of the application. This approach has the following advantages:
The following table lists some factors to consider when designing your Visual Basic application.
Factor | Item |
Language | Strings in the user interface (menus, dialog boxes, and error messages)
Printed and online documentation |
Locale-specific settings | Date/time formats (separators, order of day/month/year)
Number formats (decimal and thousand separators) Currency formats (symbol and format) Sort order and string comparison |
The first factor, language, is addressed primarily in the design phase of your Visual Basic application. See "Designing an International-Aware User Interface" for more information. The second factor, locale-specific settings, is discussed in "Writing International Code in Visual Basic" and "International Sort Order and String Comparison" later in this chapter.