#include <locale.h>
L'header <locale.h> dichiara i tipi di dati, funzioni e macro utili per questo scopo.
Le funzioni che vengono dichiarate sono setlocale() per impostare la localizzazione corrente e localeconv() per ottenere informazioni sul modo di formattare i numeri.
Le differenti categorie di informazioni locali di cui un programma potrebbe aver bisogno vengono dichiarate come macro. Usandole come primo argomento alla funzione setlocale() è possibile impostare una delle seguenti localizzazioni:
Se il secondo argomento a setlocale() è la stringa vuota "", allora la localizzazione predefinita è determinata come segue:
I valori che descrivono la formattazione locale dei numeri sono dispobili in una struct lconv restituita dalla funzione localeconv(), che è così dichiarata:
struct lconv {
/* Numeric (non-monetary) information */
char *decimal_point; /* Radix character */
char *thousands_sep; /* Separator for digit groups to left
of radix character */
char *grouping; /* Each element is the number of digits in a
group; elements with higher indices are
further left. An element with value CHAR_MAX
means that no further grouping is done. An
element with value 0 means that the previous
element is used for all groups further left. */
/* Remaining fields are for monetary information */
char *int_curr_symbol; /* First three chars are a currency symbol
from ISO 4217. Fourth char is the
separator. Fifth char is ' '. */
char *currency_symbol; /* Local currency symbol */
char *mon_decimal_point; /* Radix character */
char *mon_thousands_sep; /* Like `thousands_sep' above */
char *mon_grouping; /* Like `grouping' above */
char *positive_sign; /* Sign for positive values */
char *negative_sign; /* Sign for negative values */
char int_frac_digits; /* Int'l fractional digits */
char frac_digits; /* Local fractional digits */
char p_cs_precedes; /* 1 if currency_symbol precedes a
positive value, 0 if succeeds */
char p_sep_by_space; /* 1 if a space separates currency_symbol
from a positive value */
char n_cs_precedes; /* 1 if currency_symbol precedes a
negative value, 0 if succeeds */
char n_sep_by_space; /* 1 if a space separates currency_symbol
from a negative value */
/* Positive and negative sign positions:
0 Parentheses surround the quantity and currency_symbol.
1 The sign string precedes the quantity and currency_symbol.
2 The sign string succeeds the quantity and currency_symbol.
3 The sign string immediately precedes the currency_symbol.
4 The sign string immediately succeeds the currency_symbol. */
char p_sign_posn;
char n_sign_posn;
};
Le funzioni GNU gettext sono specificate in LI18NUX2000.