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,  and  so  on.  A program needs to be able to determine its
15       locale 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 locale 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_ADDRESS (GNU extension, since glibc 2.2)
29              Change  settings  that  describe  the  formats (e.g., postal ad‐
30              dresses) used to describe locations and geography-related items.
31              Applications  that  need this information can use nl_langinfo(3)
32              to retrieve  nonstandard  elements,  such  as  _NL_ADDRESS_COUN‐
33              TRY_NAME  (country  name,  in  the  language  of the locale) and
34              _NL_ADDRESS_LANG_NAME (language name, in the language of the lo‐
35              cale),  which return strings such as "Deutschland" and "Deutsch"
36              (for German-language locales).  (Other element names are  listed
37              in <langinfo.h>.)
38
39       LC_COLLATE
40              This  category  governs the collation rules used for sorting and
41              regular expressions, including character equivalence classes and
42              multicharacter collating elements.  This locale category changes
43              the behavior of the functions strcoll(3) and  strxfrm(3),  which
44              are used to compare strings in the local alphabet.  For example,
45              the German sharp s is sorted as "ss".
46
47       LC_CTYPE
48              This category determines the interpretation of byte sequences as
49              characters (e.g., single versus multibyte characters), character
50              classifications (e.g., alphabetic or digit), and the behavior of
51              character  classes.  On glibc systems, this category also deter‐
52              mines the  character  transliteration  rules  for  iconv(1)  and
53              iconv(3).  It changes the behavior of the character handling and
54              classification functions, such as isupper(3) and toupper(3), and
55              the multibyte character functions such as mblen(3) or wctomb(3).
56
57       LC_IDENTIFICATION (GNU extension, since glibc 2.2)
58              Change settings that relate to the metadata for the locale.  Ap‐
59              plications that need this information can use nl_langinfo(3)  to
60              retrieve  nonstandard elements, such as _NL_IDENTIFICATION_TITLE
61              (title of this locale document) and _NL_IDENTIFICATION_TERRITORY
62              (geographical  territory to which this locale document applies),
63              which might return strings such as "