Share via


Visual Basic Concepts

Designing International Software

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.

Advantages of Designing International Software

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:

  • You can launch your Visual Basic application onto the market more rapidly. No additional international development is needed once the initial version of the product is complete.

  • You use resources more efficiently. Adding international support to your finished Visual Basic application may make it less stable. More development and testing resources would be required than if the same support had been implemented as part of the original development process.

  • If the international version of your Visual Basic application is built from the same set of sources as the version in which you originally developed your application, only isolated modules need international attention, thus making it easier and less expensive to maintain code while including international support. See "Using Resource Files for Localization" later in this chapter.

  • Developing an international version of your application becomes easy. For instance, you can develop an English-language version of your application that runs in a German operating environment without rewriting code. You only need to customize the user interface. See "Designing an International-Aware User Interface" later in this chapter.

Localization Model

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:

  • Efficiency. Developing a new international version of the application only involves creating a new international resource file because each version has the same code block. This streamlines the creation of multiple language versions of your Visual Basic application.

  • Greater security. Whether you decide to localize your application in-house or to use an external company, you won't need to access source code to develop international versions of your application. This approach will also lower the amount of testing needed for the international version.

  • Better localization. By placing all string resources in one file, you ensure a more efficient localization process and reduce the chance of leaving some strings unlocalized.

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.