C Programming/locale.h

In computing, locale.h is a C programming language header file, used for purposes of localization. The header provides two key functions:  and. The former provides access to the current locale, while the latter allows one to set the current locale. The header also defines the struct, which stores information about a given locale, including the local preference for the display of numbers and currency.

function
The  function is used to set or query the program's current locale.

If  is not , the program's current locale is modified according to the arguments. The argument  determines which parts of the program's current locale should be modified.

If  is , the current locale is only queried, not modified.

function
The  function returns a pointer to a   for the current locale. This structure is shown in next section below, and contains all values associated with the locale categories LC_NUMERIC and LC_MONETARY. Programs may also use the functions  and , which behave according to the actual locale in use.

struct
The  contains the following fields:

Numeric (nonmonetary) information
Radix character.

Separator for digit groups to left of radix character.

Each element is the number of digits in a group; elements with higher indices are further left. An element with value means that no further grouping is done. An element with value  means that the previous element is used for all groups further left.

Monetary information
First three chars are a currency symbol from ISO 4217. Fourth char is the separator. Fifth char is.

Local currency symbol.

Like  above.

Like  above.

Like  above.

Sign for positive values.

Sign for negative values.

International fractional digits.

Local fractional digits.

if  precedes a positive value,   if succeeds.

if a space separates from a positive value.

if  precedes a negative value,   if succeeds.

if a space separates from a negative value.

Positive and negative sign positions:
 * : Parentheses surround the quantity and.
 * : The sign string precedes the quantity and.
 * : The sign string succeeds the quantity and.
 * : The sign string immediately precedes the.
 * : The sign string immediately succeeds the.