RAD Studio |  |

Creating international applications
Collapse All
Topics

Name | Description
Creating International Applications: Overview | This topic discusses guidelines for writing applications that you plan to distribute to an international market. By planning ahead, you can reduce the amount of time and code necessary to make your application function in its foreign market as well as in its domestic market. The following topics are discussed in this section: Internationalization and localization Internationalizing applications Localizing applications
Internationalization and Localization | To create an application that you can distribute to foreign markets, there are two major steps that need to be performed: Internationalization Localization If your edition includes the Translation Tools, you can use the them to manage localization.
Internationalization | Internationalization is the process of enabling your program to work in multiple locales. A locale is the user's environment, which includes the cultural conventions of the target country as well as the language. Windows supports many locales, each of which is described by a language and country pair.
Localization | Localization is the process of translating an application so that it functions in a specific locale. In addition to translating the user interface, localization may include functionality customization. For example, a financial application may be modified for the tax laws in different countries.
Internationalizing Applications | You need to complete the following steps to create internationalized applications: Enable your code to handle strings from international character sets. Design your user interface to accommodate the changes that result from localization. Isolate all resources that need to be localized.
Enabling Application Code | You must make sure that the code in your application can handle the strings it will encounter in the various target locales. To do this, you must consider the following: Character sets OEM and ANSI character sets Multibyte character sets Wide characters Locale-specific features
Character Sets | The Western editions (including English, French, and German) of Windows use the ANSI Latin-1 (1252) character set. However, other editions of Windows use different character sets. For example, the Japanese version of Windows uses the Shift-JIS character set (code page 932), which represents Japanese characters as multibyte character codes. There are generally three types of characters sets: Single-byte Multibyte Wide characters Windows and Linux both support single-byte and multibyte character sets as well as Unicode. With a single-byte character set, each byte in a string represents one character. The ANSI character set used by many western operating systems is a... more
OEM and ANSI Character Sets | It is sometimes necessary to convert between the Windows character set (ANSI) and the character set specified by the code page of the user's machine (called the OEM character set).
Multibyte Character Sets (MBCS) | The ideographic character sets used in Asia cannot use the simple 1:1 mapping between characters in the language and the one byte (8-bit) AnsiChar type. These languages have too many characters to be represented using the single-byte AnsiChar. Instead, a multibyte character set string can contain one or more bytes per character. A multibyte character set provides a way to encode characters outside the standard ANSI range into single byte strings of AnsiChar. The lead byte of every multibyte character code is taken from a reserved range that depends on the specific character set. The second and subsequent... more
Wide Characters | One approach to working with ideographic character sets is to use a character encoding scheme that maps each character to a numeric value (or code point) that is larger than one byte. Such characters are referred to as wide characters. A code page is a specific mapping of characters to code points. Many systems for encoding characters have been devised. For instance, shift JIS is a character encoding for Japanese. Characters are represented by one or two byte code points. A string of such characters is a single byte string with characters of variable-width encoding. Multibyte ... more
Including Bi-directional Functionality in Applications | Some languages do not follow the left to right reading order commonly found in western languages, but rather read words right to left and numbers left to right. These languages are termed bi-directional (BiDi) because of this separation. The most common bi-directional languages are Arabic and Hebrew, although other Middle East languages are also bi-directional. TApplication has two properties, BiDiKeyboard and NonBiDiKeyboard, that allow you to specify the keyboard layout. In addition, the VCL supports bi-directional localization through the BiDiMode and ParentBiDiMode properties. Note: Bi-directional properties are not available for cross-platform applications. The BiDiMode property controls the reading order... more
ParentBiDiMode Property | ParentBiDiMode is a Boolean property. When True (the default) the control looks to its parent to determine what BiDiMode to use. If the control is a TForm object, the form uses the BiDiMode setting from Application. If all the ParentBiDiMode properties are True, when you change Application's BiDiMode property, all forms and controls in the project are updated with the new setting.
FlipChildren Method | The FlipChildren method allows you to flip the position of a container control's children. Container controls are controls that can accept other controls, such as TForm, TPanel, and TGroupBox.FlipChildren has a single boolean parameter, AllLevels. When False, only the immediate children of the container control are flipped. When True, all the levels of children in the container control are flipped. Delphi flips the controls by changing the Left property and the alignment of the control. If a control's left side is five pixels from the left edge of its parent control, after it is flipped... more
Additional Methods | There are several other methods useful for developing applications for bi-directional users. VCL methods that support BiDi
Locale-specific Features | You can add extra features to your application for specific locales. In particular, for Asian language environments, you may want your application to control the input method editor (IME) that is used to convert the keystrokes typed by the user into character strings. Controls offer support in programming the IME. Most windowed controls that work directly with text input have an ImeName property that allows you to specify a particular IME that should be used when the control has input focus. They also provide an ImeMode property that specifies how the IME should convert keyboard input. ImeName introduces several... more
Localization Considerations in UI Design | When creating an application for several foreign markets, it is important to design your user interface so that it can accommodate the changes that occur during translation. The following topics are discussed in this section: Text Graphic images Formats and sort order Keyboard mappings
Text | All text that appears in the user interface must be translated. English text is almost always shorter than its translations. Design the elements of your user interface that display text so that there is room for the text strings to grow. Create dialogs, menus, status bars, and other user interface elements that display text so that they can easily display longer strings. Avoid abbreviations—they do not exist in languages that use ideographic characters. Short strings tend to grow in translation more than long phrases. The following table provides a rough estimate of how much expansion you should plan for given... more
Graphic Images | Ideally, you will want to use images that do not require translation. Most obviously, this means that graphic images should not include text, which will always require translation. If you must include text in your images, it is a good idea to use a label object with a transparent background over an image rather than including the text as part of the image. There are other considerations when creating graphic images. Try to avoid images that are specific to a particular culture. For example, mailboxes in different countries look very different from each other. Religious symbols are not appropriate if... more
Formats and Sort Order | The date, time, number, and currency formats used in your application should be localized for the target locale. If you use only the Windows formats, there is no need to translate formats, as these are taken from the user's Windows Registry. However, if you specify any of your own format strings, be sure to declare them as resourced constants so that they can be localized. The order in which strings are sorted also varies from country to country. Many European languages include diacritical marks that are sorted differently, depending on the locale. In addition, in some countries, two-character... more
Keyboard Mappings | Be careful with key-combinations shortcut assignments. Not all the characters available on the US keyboard are easily reproduced on all international keyboards. Where possible, use number keys and function keys for shortcuts, as these are available on virtually all keyboards.
Isolating Resources | The most obvious task in localizing an application is translating the strings that appear in the user interface. To create an application that can be translated without altering code everywhere, the strings in the user interface should be isolated into a single module. Delphi automatically creates a .dfm file that contains the resources for your menus, dialogs, and bitmaps. In addition to these obvious user interface elements, you will need to isolate any strings, such as error messages, that you present to the user. String resources are not included in the form file. You can isolate them by declaring constants... more
Creating Resource DLLs | Isolating resources simplifies the translation process. The next level of resource separation is the creation of a resource DLL. A resource DLL contains all the resources and only the resources for a program. Resource DLLs allow you to create a program that supports many translations simply by swapping the resource DLL. Use the Resource DLL wizard to create a resource DLL for your program. The Resource DLL wizard requires an open, saved, compiled project. It will create an RC file that contains the string tables from used RC files and resourcestring strings of the project, and generate a project for... more
Using Resource DLLs | The executable, DLLs, and packages (bpls) that make up your application contain all the necessary resources. However, to replace those resources by localized versions, you need only ship your application with localized resource DLLs that have the same name as your executable, DLL, or package files. When your application starts up, it checks the locale of the local system. If it finds any resource DLLs with the same name as the EXE, DLL, or BPL files it is using, it checks the extension on those DLLs. If the extension of the resource module matches the language and country of the... more
Dynamic Switching of Resource DLLs | In addition to locating a resource DLL at application startup, it is possible to switch resource DLLs dynamically at runtime. To add this functionality to your own applications, you need to include the ReInit unit in your uses statement. (ReInit is located in the Richedit sample in the Demos directory.) To switch languages, you should call LoadResourceModule, passing the LCID for the new language, and then call ReinitializeForms. For example, the following code switches the interface language to French:
Localizing Applications | Once your application is internationalized, you can create localized versions for the different foreign markets in which you want to distribute it.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!