A locale is a set of language and cultural rules. These cover aspects such as language for messages, different character sets, lexigraphic conventions, etc. A program needs to be able to determine its locale and act accordingly to be portable to different cultures.
The header declares data types, functions and macros which are useful in this task.
The functions it declares are setlocale() to set the current locale, and localeconv() to get information about number formatting.
There are different categories for local information a program might need; they are declared as macros. Using them as the first argument to the setlocale() function, it is possible to set one of these to the desired locale:
This is used to change the behaviour of the functions strcoll() and strxfrm(), which are used to compare strings in the local alphabet. For example, the German sharp s is sorted as __
This changes the behaviour of the character handling and classification functions, such as isupper() and toupper(), and the multi-byte character functions such as mblen() or wctomb().
changes the information returned by localeconv() which describes the way numbers are usually printed, with details such as decimal point versus decimal comma. This information is internally used by the function strfmon().
changes the language messages are displayed in and how an affirmative or negative answer looks like. The GNU C-library contains the rpmatch() function to ease the use of these information.
changes the information used by the printf() and scanf() family of functions, when they are advised to use the locale-settings. This information can also be read with the localeconv() function.
changes the behaviour of the strftime() function to display the current time in a locally acceptable form; for example, most of Europe uses a 24-hour clock vs. the US' 12-hour clock.
All of the above.
If the second argument to setlocale() is empty string, , for the default locale, it is determined using the following steps:
If there is a non-null environment variable LC_ALL, the value of LC_ALL is used.
If an environment variable with the same name as one of the categories above exists and is non-null, its value is used for that category.
If there is a non-null environment variable LANG, the value of LANG is used.
Values about local numeric formatting is made available in a struct lconv returned by the localeconv() function, which has the following declaration:
lib/main.php:944: Notice: PageInfo: Cannot find action page