### <locale.h>

The <locale.h> include file declares the localdtconv, localeconv, and setlocale library functions, which are useful for changing the C locale when you are creating applications for international users. <locale.h> also declares the lconv structure.

The table below shows the elements of the lconv structure as well as the defaults for the C locale.

Elements of the lconv structure:

Element | Purpose of Element | Default
char *decimal_point | Decimal-point character used to format nonmonetary quantities. | "."
char *thousands_sep | Character used to separate groups of digits to the left of the decimal-point character in formatted nonmonetary quantities. | ""
char *grouping | String indicating the size of each group of digits in formatted nonmonetary quantities. The value of each character in the string determines the number of digits in a group. A value of CHAR_MAX indicates that there are no further groupings. 0 indicates that the previous element is to be used for the remainder of the digits. | ""
char *int_curr_symbol | International currency symbol for the current locale. The first three characters contain the alphabetic international currency symbol. The fourth character (usually a space) is the character used to separate the international currency symbol from the monetary quantity. | ""
char *currency_symbol | Local currency symbol of the current locale. | ""
char *mon_decimal_point | Decimal-point character used to format monetary quantities. | ""
char *mon_thousands_sep | Separator for digits in formatted monetary quantities | ""
char *mon_grouping | String indicating the size of each group of digits in formatted monetary quantities. The value of each character in the string determines the number of digits in a group. A value of CHAR_MAX indicates that there are no further groups. 0 indicates that the previous element is to be used for the remainder of the digits. | ""
char *positive_sign | String indicating the positive sign used in monetary quantities. | ""
char *negative_sign | String indicating the negative sign used in monetary quantities. | ""
char *int_frac_digits | The number of displayed digits to the right of the decimal place for internationally formatted monetary quantities. | UCHAR_MAX
char frac_digits | Number of digits to the right of the decimal place in monetary quantities. | UCHAR_MAX
char p_cs_precedes | 1 if the currency_symbol precedes the value for a nonnegative formatted monetary quantity; 0 if it does not. | UCHAR_MAX
char p_sep_by_sep | 1 if the currency_symbol is separated by a space from the value of a nonnegative formatted monetary quantity; 0 if it does not; 2 if a space separates the symbol and the sign string -- if adjacent. | UCHAR_MAX
char n_cs_precedes | 1 if the currency_symbol precedes the value for a negative formatted monetary quantity; 0 if it does not. | UCHAR_MAX
char n_sep_by_space | 1 if the currency_symbol is separated by a space from the value of a negative formatted monetary quantity; 0 if it does not; 2 if a space separates the symbol and the sign string -- if adjacent. | UCHAR_MAX
char p_sign_posn | Value indicating the position of the positive_sign for a nonnegative formatted monetary quantity. | UCHAR_MAX
char n_sign_posn | Value indicating the position of the negative_sign for a negative formatted monetary quantity. | UCHAR_MAX
char *left_parenthesis | Negative-valued monetary symbol. | ""
char *right_parenthesis | Negative-valued monetary symbol. | ""
char *debit_sign | Debit_sign characters. | ""
char *credit_sign | Credit_sign characters. | ""

<locale.h> declares the dtconv structure:

    struct dtconv {
    	char *abbrev_month_names[12];	/* Abbreviated month names	*/
    	char *month_names[12\;		/* full month names		*/
    	char *abbrev_day_names[7];	/* Abbreviated day names	*/
    	char *day_names[7];		/* full day names		*/
    	char *date_time_format;		/* date and time format		*/
    	char *date_format;		/* date format			*/
    	char *time_format;		/* time format			*/
    	char *am_string;		/* AM string			*/
    	char *pm_string;		/* PM string			*/
    	char *time_format_ampm;		/* long date format		*/

The information in each field is equivalent to calling nl_langinfo with these keywords:

Keyword | Element
ABMON_nn | abbrev_month_names
MON_nn | month_names
ABDAY_nn | abbrev_day_names
DAY_nn | day_names
D_T_FMT | date_time_format
D_FMT | date_format
T_FMT | time_format
AM_STR | am_string
PM_STR | pm_string
T_FMT_AMPM | time_format_ampm

Where nn is the number corresponding to the day or the month. For example, DAY_7 is the seventh day and ABMON_12 is the abbreviated twelfth month.

<locale.h> also contains definitions for the following macros:

LC_ALL | LC_NUMERIC
LC_COLLATE | LC_TIME
LC_CTYPE | LC_SYNTAX
LC_MESSAGES | LC_MONETARY
LC_TOD | NULL

The aspects of a program related to national language, or to cultural characteristics (such as time zone, currency symbols, and sorting order of characters), can be customized at run time using different locales, to suit users' requirements at those locales.

Internationalization