Programmer's Reference

The POSIX locale model

The POSIX locale model divides locale-dependent information into six locale categories that assist in the development of internationalized applications. Each locale category controls the behavior of a predefined set of operations and is associated with a particular locale. Locale categories are represented by symbolic constants describing their function and are prefixed by LC_. The locale categories defined by the POSIX model are listed in the following figure, along with a brief description of the responsibilities and functions controlled by each category.
POSIX locale model

Each locale category controls the behavior of a predefined set of operations and ensures that the operations under its control behave properly for the locale associated with the category. For example, the LC_COLLATE category maintains information pertinent to string sorting, and, if configured for the U.S. English locale, ensures that strings are sorted according the rules for U.S. English.

Locale categories function independently within an application and need not be associated with the same locale. For example, it is possible for an application to format monetary quantities according to the rules for U.S. English and to display messages in French by setting the LC_MONETARY and LC_MESSAGES categories appropriately.

Each process (application) maintains its own set of locale category information, and can configure the locale categories appropriately for the needs of the application. The POSIX locale model provides a well defined set of locale-sensitive operations and a mechanism for controlling the behavior of these operations. By using these locale-sensitive operations, the same internationalized application can support several locales simply by altering the settings of the locale categories.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]