The principle underlying the concept of “locale” is to enable the behavior of C programs to be modified to take account of national conventions, standards and languages.
The locale directly affects the execution of certain C library functions. The localeconv
function makes locale-specific information available in a structure which can be used for formatted output (printf
, fprintf
etc.).
The locale comprises the following categories:
LC_COLLATE | The sort sequence of the character set affects the behavior of the |
LC_CTYPE | Classification of the characters affects the behavior of the character |
LC_MONETARY | The conventions for representing monetary values (e.g. currency) |
LC_NUMERIC | The conventions for representing non-monetary numerical values |
LC_TIME | The conventions for representing the date and time affect the |
The C runtime system provides some predefined locales (see section “Predefined locale C”). Users can also define their own locales (see section “Compatible locales V1CTYPE and V2CTYPE”).
CRTE provides the predefined locales De.EDF04F and De.EDF04F@euro to support the euro. The only difference between these two locales lies in the category LC_MONETARY, which represents the German Mark (DM) for the locale De.EDF04F, and the euro for the locale De.EDF04F@euro.
The locale under which the C program is to run is selected with the setlocale
function. Detailed descriptions of the C library functions mentioned in this section can be found in the reference section of this manual.
The locale C is preset by default, provided the main
routine is not a C V1.0 object; in this case, the locale “V1CTYPE” or LC_C_V1CTYPE is set automatically when the program starts.