The locale is a subset of the settings for the runtime environment. It affects the behavior of C programs with respect to country-specific conventions, norms and languages. The locale consists of one or more categories. The following categories are supported in XPG4 Version 2-conformant environments:
| Determines all values of the current locale. Determines the collating sequence of characters. Each character is defined The name of the corresponding definition file in the POSIX subsystem is The corresponding table in BS2000 is named | ||||||||||||||||||||||||
| Determines character classification (i.e. the assignment of characters to The name of the corresponding definition file in the POSIX subsystem is There are 3 tables in BS2000 for all EBCDIC characters: The classification table
The C values are defined in the header file The tables for converting uppercase letters to lowercase ( |
These tables are used by the macros toupper()
and tolower()
for
converting to uppercase and lowercase letters, respectively. The table
needs to be filled only for characters which are classified as uppercase or lowercase letters in the classification table.
LC_MESSAGES
Determines the format of messages.
The name of the corresponding definition file in the POSIX subsystem is/usr/lib/locale/
locale/LC_MESSAGES
.
This category is not supported by the BS2000 functionality.
LC_MONETARY
Determines the formats of monetary values.
The name of the corresponding definition file in the POSIX subsystem is | |
| Determines the representation of non-monetary numeric values for The name of the corresponding definition file in the POSIX subsystem is |
| Determines the date and time representation for calls to The name of the corresponding definition file in the POSIX subsystem is |
These locale categories are also defined as environment variables.
The behavior of XPG4 Version 2-conformant commands (e.g. the POSIX commands) is affected by the current locale (see section “Environment variables” and the manual "POSIX Commands" [2 (Related publications)]). The C library functions setlocale()
and localeconv()
may be used to change the current locale of a C program at runtime.
The following C library functions are directly affected by the current locale:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The C runtime library provides some predefined locales (see the section “Predefinedlocales”). However, users may also define their own locales (see section“Userspecific locales” (User-specific locales)).
CRTE provides the predefined locales De.EDF04F
and De.EDF04F@euro
to support the Euro. These two locales differ only by the category LC_MONETARY
that represents the German mark (DM) for the locale De.EDF04F
and the Euro for the locale De.EDF04F@euro
.
When the value of a locale environment variable begins with a slash (/), it is interpreted as the pathname of the locale definition.
Applications can change the current locale, i.e. set some other predefined locale by invoking setlocale()
with the appropriate value. If the function is called with an empty string for locale, then the value of the environment variable that was specified using the category argument is evaluated:
setlocale(LC_ALL, "");
In this case all categories are determined by the corresponding environment variables. If the environment variable is unset or is set to an empty string, the environment is evaluated (see also section “Environment variables”).