1LOCALE(7)                  Linux Programmer's Manual                 LOCALE(7)
2
3
4

NAME

6       locale - Description of multilanguage support
7

SYNOPSIS

9       #include <locale.h>
10

DESCRIPTION

12       A  locale is a set of language and cultural rules.  These cover aspects
13       such as language for messages, different character sets,  lexicographic
14       conventions,  etc.   A program needs to be able to determine its locale
15       and act accordingly to be portable to different cultures.
16
17       The header <locale.h> declares data types, functions and  macros  which
18       are useful in this task.
19
20       The  functions  it declares are setlocale(3) to set the current locale,
21       and localeconv(3) to get information about number formatting.
22
23       There are different categories for local information  a  program  might
24       need; they are declared as macros.  Using them as the first argument to
25       the setlocale(3) function, it is possible to set one of  these  to  the
26       desired locale:
27
28       LC_COLLATE
29              This  is used to change the behavior of the functions strcoll(3)
30              and strxfrm(3), which are used to compare strings in  the  local
31              alphabet.  For example, the German sharp s is sorted as "ss".
32
33       LC_CTYPE
34              This  changes the behavior of the character handling and classi‐
35              fication functions, such as isupper(3) and toupper(3),  and  the
36              multibyte character functions such as mblen(3) or wctomb(3).
37
38       LC_MONETARY
39              changes   the   information   returned  by  localeconv(3)  which
40              describes the way numbers are usually printed, with details such
41              as  decimal  point  versus  decimal  comma.  This information is
42              internally used by the function strfmon(3).
43
44       LC_MESSAGES
45              changes the language messages  are  displayed  in  and  what  an
46              affirmative  or  negative  answer looks like.  The GNU C-library
47              contains the gettext(3), ngettext(3), and  rpmatch(3)  functions
48              to ease the use of these information.  The GNU gettext family of
49              functions also obey the environment variable LANGUAGE  (contain‐
50              ing a colon-separated list of locales) if the category is set to
51              a valid locale other than "C".
52
53       LC_NUMERIC
54              changes the information used by the printf(3) and scanf(3)  fam‐
55              ily  of  functions, when they are advised to use the locale-set‐
56              tings.  This information can also be read with the localeconv(3)
57              function.
58
59       LC_TIME
60              changes  the behavior of the strftime(3) function to display the
61              current time in a locally acceptable form; for example, most  of
62              Europe uses a 24-hour clock versus the 12-hour clock used in the
63              United States.
64
65       LC_ALL All of the above.
66
67       If the second argument to setlocale(3) is empty  string,  "",  for  the
68       default locale, it is determined using the following steps:
69
70       1.     If there is a non-null environment variable LC_ALL, the value of
71              LC_ALL is used.
72
73       2.     If an environment variable with the same name as one of the cat‐
74              egories above exists and is non-null, its value is used for that
75              category.
76
77       3.     If there is a non-null environment variable LANG, the  value  of
78              LANG is used.
79
80       Values  about  local  numeric  formatting is made available in a struct
81       lconv returned by the localeconv(3) function, which has  the  following
82       declaration:
83
84         struct lconv {
85
86             /* Numeric (nonmonetary) information */
87
88             char *decimal_point;     /* Radix character */
89             char *thousands_sep;     /* Separator for digit groups to left
90                                         of radix character */
91             char *grouping; /* Each element is the number of digits in a
92                                group; elements with higher indices are
93                                further left.  An element with value CHAR_MAX
94                                means that no further grouping is done.  An
95                                element with value 0 means that the previous
96                                element is used for all groups further left. */
97
98             /* Remaining fields are for monetary information */
99
100             char *int_curr_symbol;   /* First three chars are a currency symbol
101                                         from ISO 4217.  Fourth char is the
102                                         separator.  Fifth char is '\0'. */
103             char *currency_symbol;   /* Local currency symbol */
104             char *mon_decimal_point; /* Radix character */
105             char *mon_thousands_sep; /* Like thousands_sep above */
106             char *mon_grouping;      /* Like grouping above */
107             char *positive_sign;     /* Sign for positive values */
108             char *negative_sign;     /* Sign for negative values */
109             char  int_frac_digits;   /* International fractional digits */
110             char  frac_digits;       /* Local fractional digits */
111             char  p_cs_precedes;     /* 1 if currency_symbol precedes a
112                                         positive value, 0 if succeeds */
113             char  p_sep_by_space;    /* 1 if a space separates currency_symbol
114                                         from a positive value */
115             char  n_cs_precedes;     /* 1 if currency_symbol precedes a
116                                         negative value, 0 if succeeds */
117             char  n_sep_by_space;    /* 1 if a space separates currency_symbol
118                                         from a negative value */
119             /* Positive and negative sign positions:
120                0 Parentheses surround the quantity and currency_symbol.
121                1 The sign string precedes the quantity and currency_symbol.
122                2 The sign string succeeds the quantity and currency_symbol.
123                3 The sign string immediately precedes the currency_symbol.
124                4 The sign string immediately succeeds the currency_symbol. */
125             char  p_sign_posn;
126             char  n_sign_posn;
127         };
128

CONFORMING TO

130       POSIX.1-2001.
131
132       The GNU gettext functions are specified in LI18NUX2000.
133

SEE ALSO

135       locale(1),   localedef(1),   gettext(3),   localeconv(3),  ngettext(3),
136       nl_langinfo(3), rpmatch(3), setlocale(3), strcoll(3), strfmon(3), strf‐
137       time(3), strxfrm(3)
138

COLOPHON

140       This  page  is  part of release 3.25 of the Linux man-pages project.  A
141       description of the project, and information about reporting  bugs,  can
142       be found at http://www.kernel.org/doc/man-pages/.
143
144
145
146Linux                             2008-12-05                         LOCALE(7)
Impressum