Windows XP Embedded Language Support Overview

 

Windows XP Embedded Language Support Overview

Microsoft Corporation
Applies to Microsoft® Windows® XP Embedded

Summary

This technical article introduces important concepts related to localization, and provides a high-level overview of how to add the necessary language support infrastructure to your run-time image. It also covers the steps involved in extending that infrastructure and adding MUI support.

Contents

Important Concepts

Locale

Character Encoding

National Language Support

Localizable Resource

Customer Scenarios

Shipping an Advanced Set-top Box to Multiple Countries

Handling Multilingual Data

Changing the UI Language of an Application

Implementing Language Support in an Embedded Design

Adding a Language Support Infrastructure

Adding MUI Support

Conclusion

Introduction

As is the case with Windows XP Professional, the Unicode-based operating system core and the Win32 API in Windows XP Embedded enable non-English applications to run on the English version of the operating system. However, if you want a more seamless user experience and localize an operating system on which non-English applications may run, you need to understand how to add language support to your run-time image.

In addition to all fonts, code pages, and keyboard layouts that are supported in Windows XP Professional, Windows XP Embedded provides language support components that enable you to add the support infrastructure for a specific language. In addition, you can add Multilingual User Interface (MUI) support, which allows users to set the user interface (UI) language according to their preferences, provided that the required language was added to the system.

This article assumes familiarity with the Windows XP Embedded tool set, including Target Designer, Target Analyzer, and Component Designer.

For more information about Windows XP Embedded, see the Windows XP Embedded documentation in the MSDN Library.

Important Concepts

The following concepts are key to understanding international support in Windows XP Professional, and, by extension, Windows XP Embedded, the componentized version of the desktop operating system.

Locale

A locale is a set of user preference information related to the user's language and sublanguage. For instance, the language could be French, and the sublanguage could be French as spoken in Canada, France, or Switzerland. Locale information includes:

  • Currency symbols
  • Date, time, and number formatting information
  • Localized days of the week and months of the year
  • The standard abbreviation for the name of the country
  • Character encoding information

For a more complete list, see the National Language Support API (NLSAPI) specification.

Each Windows XP system has a default system locale and one user locale per user, which may be different from the default system locale. Both can be changed through Control Panel. Applications can specify a locale on a per-thread basis by calling the appropriate Win32 APIs.

Dd143261.xpe_lang_sup_options(en-US,WinEmbedded.5).gif

Figure 1. Regional and language options found in Control Panel

Character Encoding

Character encoding, also called a code page, is a set of numeric values, or code points, that represent a group of alphanumeric characters, punctuation, and symbols. Single-byte character encoding uses 8-bits to encode 256 different characters. In Windows, the first 128 characters of all code pages consist of the standard ASCII set of characters. The range of characters from code point 128 – 255 represent additional characters and vary depending on the set of scripts represented by the character encoding (for a complete listing of character set tables see Developing International Software for Windows 95 and Windows NT, published by Microsoft Press). Double-byte character encodings on Windows, used for Asian languages, use 8 to 16 bits to encode each character. Computers exchange information encoded in character encodings and render it on screens using fonts.

Dd143261.xpe_lang_sup_characters(en-US,WinEmbedded.5).gif

Figure 2. Code page 1256, Arabic character encoding

Windows XP Professional supports the original equipment manufacturer (OEM) character set (those originally designed for MS-DOS), the ANSI character set (those introduced with Windows 3.1), and Unicode. Unicode is a 16-bit character set that encompasses most of the scripts in wide computer use today (for more information about Unicode, see The Unicode Standard published by the Unicode Consortium, or visit www.unicode.org). Windows XP uses Unicode as its base character set, meaning that all strings passed around internally in the system, including strings in Windows resource (.res) files, are Unicode. Windows XP also supports the ANSI character set. Each API that takes a string as a parameter has two entry points—an 'A' or ANSI entry point and a 'W' or wide-character (Unicode) entry point.

Windows XP supports additional code pages for translating data to and from Unicode, including Macintosh, EBCDIC, and ISO. It also contains translation tables for the UTF-7 and UTF-8 standards, which are commonly used to send Unicode-based data across networks, in particular the Internet.

National Language Support

National Language Support (NLS) in Windows XP consists of a set of system tables that applications can access through the NLSAPI. The NLSAPI retrieves the following types of information:

  • Locale information. For example, date, time, number, or currency format, or localized names of countries, languages, or days of the month and week.
  • Character mapping tables. For example, character mapping tables that map local character encodings (ANSI or OEM) to Unicode or character mapping tables that map Unicode to local character encodings.
  • Keyboard layout information. For example, because Windows keyboards use layouts that are software driven, the same keyboard hardware can be used to generate a variety of different language scripts.
  • Character typing information. For example, whether a specific Unicode code point is a letter, a number, a spacing character, or a punctuation symbol; whether a character is uppercase or lowercase; or what a character's uppercase or lowercase equivalent is for a particular locale.
  • Sorting information. For example, different locales follow different sorting rules for accented characters, or may support more than one sorting algorithm.
  • Font information. For example, system-stored information about which fonts support which character encodings or which ranges of Unicode. APIs exist to map which languages the font will support.

On Windows XP, users can install National Language Support for any locale by using Control Panel (see Figure 1). In Windows XP Embedded, support for a specific language and locale is enabled by adding the appropriate components to the run-time configuration.

Localizable Resource

A localizable resource is any piece of information in a software program that will change from language to language. Although certain algorithms may change depending on language (for example, spelling or hyphenation), localizable resources are generally UI elements. Examples include menus, dialog boxes, help text, icons, and bitmaps. On Windows, most of these resources are stored in Windows resource files. In text form, Windows resource files have the extension ".rc". Resource files have the ".res" extension and are compiled directly into the application executable. On Windows XP Professional, all languages can share the same binary executable. All that needs to change to support a new language are the localizable resources. The same is true for Windows XP Embedded.

Customer Scenarios

The following customer scenarios discuss the business and technical applications of language support in Windows XP Embedded.

Shipping an Advanced Set-top Box to Multiple Countries

You are a French manufacturer of an advanced set-top box, and you have a new distribution channel in China. You are also investigating market opportunities in Russia.

Your set-top boxes were built using the English version of Windows XP Embedded. To adapt to the French market, you simply added the French Language Component to your configuration, as well as the French language MUI pack. You repeat these steps using the Russian language component and language pack to configure the run-time image for the target device to be distributed in Russia. With little effort, your set-top boxes are now ready to ship to China and Russia.

How it Works

By adding the appropriate language support infrastructure to your Windows XP Embedded configuration, you can easily localize the operating system of a device without having to build it from scratch. The Regional and Language Options component in Target Designer provides configuration options for setting:

  • The language of the UI
  • Language and country-specific standards and formats, such as date or currency
  • The input language
  • The language for non-Unicode (legacy) applications
  • Geographical location settings for the default user account (for applications that require the location of the device)

By selecting the appropriate settings, you can easily update the run-time image of a French language device to Chinese or Russian, as in the case of the set-top box OEM in the scenario above. Learn more about how to add language components to Windows XP Embedded in the "Implementing Language Support in an Embedded Design" section.

Handling Multilingual Data

An OEM provides an Internet kiosk to be installed in international airports around the world that support the following user scenario:

A translator for the European Union speaks six languages and logs on to an Internet kiosk running Windows XP Embedded. The translator wants to create a single document that contains translations of a recent meeting in English, French, German, Dutch, and Greek. She opens a document that contains her French notes, edits it, and spell checks it. She then clicks on the taskbar to change her input language to English. She translates the French text into English. As she types, the keyboard behaves like a French keyboard. When she is ready to begin the German section, she clicks on the taskbar to select her German input language. The keyboard still behaves like a French keyboard. Before she begins the Greek section, she selects the Greek input language. The keyboard now behaves as a Greek keyboard, and the text appears in her document in a Greek font. When she is done, she moves the cursor to the beginning of the document, and spell checks the entire document. She finds two minor spelling errors in the English section and one in the Greek section. She attaches the document in an e-mail and sends it off for proofing before catching her plane.

How it Works

Different countries have different keyboard layouts. For example, compared with the U.S. keyboard layout, the French keyboard layout supports additional characters (for example, for accented letters) and places others in a different physical position (on a French keyboard, "z" and "w" are reversed relative to their position on the U.S. keyboard). People who speak different languages may be able to type in different languages, but they generally prefer to use one keyboard layout to enter text for all languages. When a language uses a different script (such as Russian and Greek), however, it is necessary to change keyboard layouts.

When an OEM includes a particular language component in the run-time configuration of a device, Windows XP Embedded stores keyboard layout information in tables that determine which character gets generated when the user presses a particular key on the keyboard hardware. Because character generation is a software issue, Windows XP Embedded can control which keyboard layout is active for which user and which application at any given time. Users can go to Control Panel and create input locales, which are best described as a language/keyboard layout pair. For example, the user in this scenario set up her Internet kiosk so that any time she typed English, she would be using the French layout. It would also be possible for her to assign a different keyboard layout to each input locale, as shown following in Figure 3.

Dd143261.xpe_lang_sup_textinputlangs(en-US,WinEmbedded.5).gif

Figure 3. Adding an input locale and assigning a keyboard layout

Using the taskbar indicator (see Figure 4) or a keyboard shortcut, she can switch between any of these input locales. When she changes input locales, Windows sends a WM_INPUTLANGCHANGEREQUEST message to the running application. If an application accepts the message, Windows generates another message that gives the application the locale ID of the new input locale. Applications can use this ID to tag text with a language property, which is useful for operations such as spellcheck or grammar checking. An application may reject the request, for example, if the system does not contain the proper fonts to display the requested language.

Dd143261.xpe_lang_sup_languagebar(en-US,WinEmbedded.5).gif

Figure 4. The taskbar indicator for input language

Windows XP Embedded stores locale/keyboard layout pairs as part of a user's profile. Different users may assign a different keyboard layout to a particular language. Each user session tracks current input locales by thread—that is, two applications running at the same time can use different input locales. In addition, an application can change the input locale for the user. For example, if the translator in this example moved her cursor from English text to Greek text, her application may choose to activate the Greek input locale. Learn how to add the appropriate language support for changing the input language in the "Implementing Language Support in an Embedded Design" section.

Changing the UI Language of an Application

An employee of an international research firm is at the library, using the online catalog on a fixed-function kiosk. The previous user ran the search application in Czech and left it running. This employee does not speak Czech. He right-clicks a little globe icon in the corner of the application, and a list of languages is displayed. He selects Spanish. The application UI redraws and changes to Spanish. He runs the application and then closes it down when he is done. The next person who runs it sees a Spanish UI.

How it Works

Applications can implement a Multilingual User Interface (MUI) in several different ways. They can base the UI language of the application on the system locale, on the user locale, or on a manually selected default. On the system described in this scenario, the application might save information about the locale ID of the most recently selected UI language. The next time it is launched, it can call SetThreadLocale with that language ID so that any APIs that retrieve UI elements from the program files retrieve elements in the appropriate language.

Using the National Language Support API (NLSAPI), an OEM can create an application that supports a MUI for a device based on Windows XP Embedded, enabling the user to change the UI language of an application by using menus or by using an application-supported keyboard shortcut. This method is useful for devices that support multiple people using the same machine with the same application running all the time, much like an ATM machine.

Alternatively, an OEM can change the application UI language by having the user change the user locale in the Control Panel regional settings. If the application contains the proper language resources and retrieves resources based on the user locale, then it automatically starts drawing them in the language of the new user locale. This mechanism is useful if more than one user is sharing the same machine, running the same applications, but in separate sessions. When each person logs on, his user locale determines the UI language for the applications. This makes it possible for an OEM to install one copy of an application with multiple language resources, rather than numerous copies of the same application in different language editions. In Windows XP Embedded, the OEM determines which languages are most appropriate for its customers, thereby limiting the number of language support components necessary to include. Learn about how to implement a MUI in Windows XP Embedded in the next section.

Implementing Language Support in an Embedded Design

This section describes the process of implementing language support in an embedded design.

Adding a Language Support Infrastructure

To build a run-time image that can process documents, standards, formats, and applications that are not written in English, you must add a language support infrastructure. This is done in Target Designer and requires only a few simple steps.

In Target Designer, add a language support component to your configuration, for example, the Japanese Language Support component. Then choose from a list of fonts, code pages, and keyboards that apply to your language in the Target Designer configuration pane.

Finally, select the appropriate check boxes for the fonts, code pages, and keyboard layouts that you want to include in your run-time image. Each check box represents additional dependencies on the corresponding component. However, these check boxes do not show whether the specific item is included in the current configuration. Consequently, if you clear a check box in the Target Designer configuration pane, the item may still be included in the configuration because of another component that has a dependency on it.

The language support infrastructure of Windows XP Embedded is also extensible. You can add your own fonts, code pages, or keyboard layouts by adding additional language support modules to the component database and applying them to your configuration.

Adding MUI Support

Windows XP Embedded supports a MUI, which enables you to change the UI of your run-time image. To use a non-English UI in your run-time image, all you need is a language pack that corresponds to the language of your choice.

Following are the basic steps to make this change to your run-time image:

  1. Using Component Database Manager, import into the component database the Lang.sld file that is located in the corresponding language pack. For example, for Japanese language support, import Langjpn.sld.
  2. In Target Designer, create a configuration that includes all your required components.
  3. Add the appropriate language support component to your configuration. For example, add the Japanese Language Support component for Japanese. All language support components are located under the Software/System/International/Infrastructure node in the component browser in Target Designer.
  4. In Target Designer, choose Settings under the main node for your language support component. Select the Include multilanguage user interface resources check box. Selecting this check box adds the UI resources that are required to display the UI of the language you want to your configuration.
  5. Add the Regional and Language Options component, which is located under the Software/System/International node in the component browser in Target Designer.
  6. In Target Designer, choose Settings under the main node for the Regional and Language Options component. Configure all settings to the language of your choice. You may choose a different language for the Standards and formats and Default input language fields, but the Language for non-Unicode programs field should be set to your language of choice.
  7. Run a dependency check, and then build the run-time image.
  8. When you boot your run-time image, verify that all applications and system modules included in Windows XP Embedded use the language you want.

Conclusion

This article has introduced key concepts related to language support in Windows XP Embedded as well as an overview of how to add the necessary infrastructure and MUI support to your localized device design. Windows XP Embedded makes it easy for OEMs to localize their devices in the languages most appropriate to their devices and customers. Language support in Windows XP Embedded allows an OEM to easily localize the operating system for its device, without having to build the run-time image from scratch for each new language. An OEM can also offer its customers a multilingual user experience, with a select number of languages appropriate to the target market. By including MUI support and the appropriate language packs, an OEM can provide to its customers a customized multilingual UI appropriate to the needs of the device and the user, while still minimizing the footprint of the run-time image.

For More Information

For more information about language support, see the Windows XP Embedded documentation in the MSDN Library.

Show: