Chapter 6 Accommodating Multilingual I/O on Microsoft Windows


  • Keyboard layout: A standard arrangement of characters on a keyboard that defines which keys produce particular characters or scan codes.
  • Language/layout pair: (1) A language installed on the system and the keyboard layout associated with it. (2) The input language.

On the surface, the input and output of data is a simple process—the user enters data with a keyboard, and the program displays that data in a font. This assessment of the process, however, assumes that all users are monolingual. What if a user tries to enter data in several different languages? The process becomes much more complicated. Different languages have different default keyboard layouts. The characters of each language might fall into different character sets that require separate fonts. How can Windows-based applications juggle multiple keyboards, character sets, and fonts?

Many Windows-based applications that are currently on the market allow the user to change font attributes (such as bold and italic) as well as font names (such as Arial and Times New Roman). Very few applications, however, allow the user to change a font from Latin to Greek or Russian, and even fewer allow the user to type multilingual text into a single document. Windows-based applications that do support multilingual text accommodate the change in fonts in different ways, creating a potentially confusing climate for users. With all this in mind, the designers of Microsoft Windows 95 created a standard mechanism for supporting multilingual data input/output via the operating system. This standard mechanism is a new set of API calls (called the Multilingual API, or MLAPI) that links together keyboard layouts, character sets, and fonts. Creating an application that supports multilingual data on Windows 95 involves several steps, the first of which is to add national language support (as described in Chapter 5). The next step is to have your application recognize when a user changes the language of the text she is entering; Windows provides a language ID for the new language that you can use to tag the text. When the user changes the input language, your application might need to change fonts; therefore, you'll also need to add code to handle the new font charset property. The final step is to accommodate complicated text display; Windows 95 supports new text layout functions that will help you preprocess and display text in multiple languages. If you're planning a multilingual application, you'll want to take advantage of these text layout functions. This chapter explains each of these steps in more detail.

Microsoft Windows NT 3.5 does not support the MLAPI, but it can take advantage of multilingual fonts, and it does fully support Unicode, which simplifies the process of storing multilingual data. Although you can write code to output text in multiple languages on Windows NT, the 3.5 release does not allow you to change keyboard layouts as flexibly as Windows 95 does. Future versions of Windows NT will inherit the support for multiple input language/keyboard layout pairs that Windows 95 introduced.