[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 User's Guide



Using Internationalized Applications

Internationalization is a method of application development that enables an application to be used in a variety of locales. The concept of a locale is used to encompass the characteristics and requirements of a given language. An internationalized application requires that any language-dependent or custom-dependent information be stored external to the application program. A locale can be characterized by several components. For example, character sets, sort order, text direction, and formats for data such as date and currency are used to describe the unique characteristics of a locale. For each different locale, information such as menu items, help information, and user prompts is defined and stored separately. The information is localized, which means that it has been tailored for a specific language and/or country.

An application designed to run in different locales examines certain resources and environment variables in order to determine which language to use when executed. An application establishes file search paths for resource files and other language-dependent information. There is a wide variety of information that can be localized. Localized information is stored in files that reside in different directories. Motif uses an underlying Xt Intrinsics mechanism (XtResolvePathname) to select and locate the appropriate files, depending on the locale.

An internationalized application can set its locale at run time, typically using an internal procedure called a language procedure. The language procedure processes data in your user environment and sets the application's locale. This feature enables you to modify your user environment and rerun an application in a different locale. An application can use a default language procedure or supply its own procedure. As a result, two applications can process the same user environment data with different results.

Refer to the user documentation for the application you intend to use for detailed instructions on using its internationalized features. For more detailed information about internationalization issues, refer to the "Internationalization" chapter in the Motif Programmer's Guide and the Programmer's Supplement for Release 5, 1991, published by O'Reilly and Associates, Inc.

Layout Direction

Layout direction is the direction that is used to display visual components such as PushButtons, PopupMenus, ScrollBars, titles, and so on. In general, this direction matches the direction that people use when reading or writing in a particular language. Languages such as English, French, German, and Swedish are read and written from left to right, top to bottom. Therefore, when users working in those languages enter characters from a computer keyboard, each new character is displayed to the right of the preceding one. These same users would also expect the layout of other visual components to be displayed from left to right. For example, when you use a Pulldown Menu to access a cascading menu in a left-to-right environment, the cascading menu pops up to the right of the Pulldown Menu. Another example is the way that ToggleButtons are laid out. In a left-to-right environment, the ToggleButton is located to the left of its text label. However, for right-to-left languages, such as Arabic or Hebrew, the ToggleButton could be located to the right of its text label. The layout direction of a visual component is defined by the application, and is affected by the environment's locale. In the example of the cascading menu, the menu would cascade to the left.

In some Asian languages, text is drawn vertically. Vertical writing is enabled when the XmTextresource XmNlayoutDirection is set to XmTOP_TO_BOTTOM. In addition to causing text that you enter to be drawn vertically, the XmText widget exhibits other behaviors consistent with this manner of entering and editing text; for example,

  1. If word wrapping is turned on, text is wrapped from one column to the next, rather than from line to line.

  2. A key binding that (in the case of English) would cause the cursor to move to the next character in the current line, instead causes the cursor to move to the next character in the current column.

  3. Input Methods

    An input method is the underlying mechanism that takes keyboard input and displays the locale's corresponding character(s) on the screen. An input method interprets the user's keystrokes based on the conventions supplied by the input method. The input method used by an application based on an alphabetic language is generally invisible. However, ideographic languages, such as Chinese or Japanese, may use an input method that composes keystrokes in a separate window called a pre-edit window. For example, you type a phonetic representation of a spoken word and the input method determines the ideographic character that is pronounced in that way. When more than one character meets the criteria, the input method displays a list of characters to select from. Once you confirm a selection in the pre-edit area, the information is passed to the application.

    Input methods can be defined by the platform vendor, an application, or a user. Information about available input methods and their features can be found in the documentation for the system or application that you are using. Motif provides support for the following input method styles: OffTheSpot, Root, None, OverTheSpot, and OnTheSpot.

    For example, when the OnTheSpot input style is used, a pre-edit string is displayed in the text widget window. Depending on the text insertion mode, new text is inserted into the existing text or overwrites it. You can edit the pre-edit string until you commit the buffer by some action such as cutting, pasting, selecting an object, moving the cursor, or using a "commit" key. For a given application, the action that cause the string to be committed depends on the implementation of the input method for that application.

    Setting and Modifying the Language Environment

    An internationalized application can dynamically set its language environment when it is run. The design of the application defines what information is expected and how it is used to set the language environment. Typically, you can modify the language environment used by an application by specifying a language resource or a language environment variable. The exact method that you use to set the language environment for an application is defined by the application, so you need to see the documentation for the application for specific information.

    Message Catalogs

    Some internationalized applications use message catalogs to display text to users. Message catalogs are files that store text that is particular to specific locales (for example, fr_FR.ISO8859-1). Refer to Chapter 5 for more information on these catalogs.


    [ Previous | Next | Contents | Glossary | Home | Search ]