INFORMIX
INFORMIX-GLS Programmer's Guide
Chapter 1: Using INFORMIX-GLS
Home Contents Index Master Index New Book

Internationalizing Programs with INFORMIX-GLS

This section provides the following information about to how to internationalize database applications with INFORMIX-GLS:

What Is Internationalization?

Internationalization is the process of creating a program that can support different languages, territories, and code sets without changing or recompiling your code. This process makes Informix database applications easily adaptable to any culture and language. For a database application, you perform internationalization on the application that accesses a database, not on the database. The data in a database that the application accesses should already be in a language that the end user can understand.

Tip: The term "internationalization" is sometimes abbreviated as "I18n," which represents the first and last letters of the word and the 18 letters in between. This abbreviation conveniently avoids the different spellings of the full word in British English (internationalisation) and American English (internationalization).
To internationalize a database application, design the application so that the tasks in Figure 1-1 do not make any assumptions about the language, territory, and code set that the application uses at runtime.

Figure 1-1
Internationalization Tasks for a Database Application

(1 of 2)

Application Task Description

User interfaces

Includes any text that is visible to end users, including menus, buttons, prompts, help text, status messages, error messages, and graphics

Character processing

Includes the following processing tasks:

Data formatting

Includes any culture-specific formats for the following types of data:

Documentation

Includes any explanatory material such as printed manuals, on-line documentation, and README files

An internationalized application dynamically obtains language-specific information for these application tasks. Therefore, one executable file for the application can support multiple languages.

What Is INFORMIX-GLS?

INFORMIX-GLS is a library of C language functions and macros that help you to develop internationalized database applications.

Internationalization and INFORMIX-GLS

Of the internationalization tasks in Figure 1-1, the INFORMIX-GLS library facilitates the following ones:

    The INFORMIX-GLS library provides functions that perform the following character-processing tasks:

Of the internationalization tasks in Figure 1-1, the INFORMIX-GLS library does not provide functions for the following ones:

    You must ensure that user interfaces are designed in a way that is not language specific. In addition, put language-specific text, menus, buttons, and messages in external files that the application can reference at runtime.

    You must ensure that any documentation that you provide is translated to the appropriate language for a particular language and territory. You might want to develop rules for the creation of documentation that simplifies the translation tasks.

Important: Although the INFORMIX-GLS library does provide functions to perform case conversions (from lowercase to uppercase and vice versa), it does not provide a way to translate words, nor does it translate data in a database. You must obtain accurate and appropriate translations of text that the end user sees. These tasks must be performed by people well versed in the application and the languages involved.

INFORMIX-GLS Compatibility

The INFORMIX-GLS library is compatible with most Informix products. It also conforms to the X/Open XPG4 internationalization standards. The following sections provide additional information about INFORMIX-GLS compatibility.

With Informix Products
Both the database server and the application must support INFORMIX-GLS for you to use it for internationalization. The following Informix application products can use INFORMIX-GLS to handle internationalization:

IUS

An ESQL/C or DataBlade API client application that uses INFORMIX-GLS can communicate with the following Informix database servers:

All of the preceding database servers support GLS functionality.

With X/Open XPG4 Internationalization Standards
INFORMIX-GLS functions are derived from the X/Open XPG4 interface. Although INFORMIX-GLS is derived from the X/Open XPG4 standards, it does not rely on the existence or absence of this interface (or any of the interfaces from which XPG4 is derived) on a particular operating system.

The name of each INFORMIX-GLS data type, macro, and function is intentionally different than the X/Open name from which it is derived. Where it benefits Informix products, INFORMIX-GLS extends or changes the X/Open functions. Therefore, the operating-system documentation for its internationalization functions does not adequately describe how to use the INFORMIX-GLS functions.

What Is Localization?

Localization is the process of adapting a product to a specific cultural environment. This process usually involves the following tasks:

Tip: The term "localization" is sometimes abbreviated as "L10n," which represents the first and last letters of the word and the 10 letters in between. This abbreviation conveniently avoids the different spellings of the full word in American English (localization) and British English (localisation).
To localize a database application, you create a database application for a specific language, territory, and code set. Localization involves the following tasks:

Important: An internationalized application is much easier localize than a non-internationalized application.

Choosing a GLS Locale

To localize your application, choose a locale that provides the culture-specific information for the language, territory, and code set that the application is to support. An Informix GLS locale is a set of Informix files that bring together information about data that is specific to a particular culture, language, or territory. In particular, a GLS locale provides the following information:

Informix products provide locales that support many languages, territories, and code sets. Locale files are located in various subdirectories under the gls directory of the INFORMIXDIR directory.

Important: Informix defines and preprocesses these locale files. You cannot modify Informix locales.
At runtime, a database application uses the following locales.
Locale Definition Purpose

Client locale

The locale that the database application uses for locale-specific information

The application uses the client locale to obtain:

Database locale

The locale that the database uses for its data

The application uses the database locale to obtain the code set for:

Server locale

The locale that the database server uses for locale-specific information

When the client application establishes a connection, the database server uses the client locale, database locale, and server locale to determine the server-processing locale for this connection. The database server uses the server-processing locale for its own internal sessions and for access to any database that the connection opens.

An application obtains the locales that it needs at runtime from its application environment. You establish the locales of the application environment as follows.
Locale Default Locale Nondefault Locale

Client locale

U.S. English

Set the CLIENT_LOCALE environment variable to the name of the desired locale.

Database locale

U.S. English

Set the DB_LOCALE environment variable to the name of the desired locale.

Server locale

U.S. English

Set the SERVER_LOCALE environment variable to the name of the desired locale.

An internationalized application makes no assumptions about how these locales are set at runtime. Once the application environment specifies the locales to use, the application can access the appropriate GLS locale files for locale-specific information. As long as Informix provides a GLS locale that supports a particular language, territory, and code set, the application can obtain the locale-specific information dynamically.

The current processing locale (sometimes called just the current locale) is the locale that is currently in effect for an application. It is based on one of the following environments:

E/C
    ESQL/C creates client applications. Therefore, the current processing locale for ESQL/C applications is the client locale.

DB API

DB API
    The current processing locale for DataBlade UDRs is the server-processing locale, which the database server determines from the client, database, and server locales.

Tip: For more information about the default locale, client locale, database locale, server locale, server-processing locale, or any of the locale environment variables, see the "Informix Guide to GLS Functionality."

Translating Messages

An internationalized application should not have any language-specific text within the application code. This language-specific text includes the following kinds of strings:

    Examples include error messages, informational messages, menu items, and button labels.

    Examples include constants, filenames, and literal characters or strings.

    Examples include yes/no responses.

Tip: You do not need to put SQL keywords (such as SELECT, WHERE, INSERT, and CREATE) in a message file. In addition, language keywords (such as if, switch, for, and char) do not need to appear in this message file.
In an internationalized application, these strings appear as references to external files, called resource files or message files. To localize these strings of the database application, you must:

    The new external files contain the translated versions of the strings that the application uses.

Tip: For more information about how to use the DBLANG environment variable, see the "Informix Guide to GLS Functionality."




INFORMIX-GLS Programmer's Guide, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.