1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\" and Copyright (C) 2014 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" Modified Sat Jul 24 17:28:34 1993 by Rik Faith <faith@cs.unc.edu>
7 .\" Modified Sun Jun 01 17:16:34 1997 by Jochen Hein
8 .\" <jochen.hein@delphi.central.de>
9 .\" Modified Thu Apr 25 00:43:19 2002 by Bruno Haible <bruno@clisp.org>
11 .TH locale 7 (date) "Linux man-pages (unreleased)"
13 locale \- description of multilanguage support
16 .B #include <locale.h>
19 A locale is a set of language and cultural rules.
21 such as language for messages, different character sets, lexicographic
22 conventions, and so on.
23 A program needs to be able to determine its locale
24 and act accordingly to be portable to different cultures.
28 declares data types, functions, and macros which are useful in this
31 The functions it declares are
33 to set the current locale, and
35 to get information about number formatting.
37 There are different categories for locale information a program might
38 need; they are declared as macros.
39 Using them as the first argument
42 function, it is possible to set one of these to the desired locale:
44 .BR LC_ADDRESS " (GNU extension, since glibc 2.2)"
45 .\" See ISO/IEC Technical Report 14652
46 Change settings that describe the formats (e.g., postal addresses)
47 used to describe locations and geography-related items.
48 Applications that need this information can use
50 to retrieve nonstandard elements, such as
51 .B _NL_ADDRESS_COUNTRY_NAME
52 (country name, in the language of the locale)
54 .B _NL_ADDRESS_LANG_NAME
55 (language name, in the language of the locale),
56 which return strings such as "Deutschland" and "Deutsch"
57 (for German-language locales).
58 (Other element names are listed in
62 This category governs the collation rules used for
63 sorting and regular expressions,
64 including character equivalence classes and
65 multicharacter collating elements.
66 This locale category changes the behavior of the functions
70 which are used to compare strings in the local alphabet.
72 the German sharp s is sorted as "ss".
75 This category determines the interpretation of byte sequences as characters
76 (e.g., single versus multibyte characters), character classifications
77 (e.g., alphabetic or digit), and the behavior of character classes.
78 On glibc systems, this category also determines
79 the character transliteration rules for
83 It changes the behavior of the character handling and
84 classification functions, such as
88 and the multibyte character functions such as
93 .BR LC_IDENTIFICATION " (GNU extension, since glibc 2.2)"
94 .\" See ISO/IEC Technical Report 14652
95 Change settings that relate to the metadata for the locale.
96 Applications that need this information can use
98 to retrieve nonstandard elements, such as
99 .B _NL_IDENTIFICATION_TITLE
100 (title of this locale document)
102 .B _NL_IDENTIFICATION_TERRITORY
103 (geographical territory to which this locale document applies),
104 which might return strings such as "English locale for the USA"
106 (Other element names are listed in
110 This category determines the formatting used for
111 monetary-related numeric values.
112 This changes the information returned by
114 which describes the way numbers are usually printed, with details such
115 as decimal point versus decimal comma.
116 This information is internally
121 This category affects the language in which messages are displayed
122 and what an affirmative or negative answer looks like.
123 The GNU C library contains the
128 functions to ease the use of this information.
129 The GNU gettext family of
130 functions also obey the environment variable
132 (containing a colon-separated list of locales)
133 if the category is set to a valid locale other than
135 This category also affects the behavior of
138 .BR LC_MEASUREMENT " (GNU extension, since glibc 2.2)"
139 Change the settings relating to the measurement system in the locale
140 (i.e., metric versus US customary units).
143 to retrieve the nonstandard
144 .B _NL_MEASUREMENT_MEASUREMENT
145 element, which returns a pointer to a character
146 that has the value 1 (metric) or 2 (US customary units).
148 .BR LC_NAME " (GNU extension, since glibc 2.2)"
149 .\" See ISO/IEC Technical Report 14652
150 Change settings that describe the formats used to address persons.
151 Applications that need this information can use
153 to retrieve nonstandard elements, such as
155 (general salutation for men)
158 (general salutation for women)
159 elements, which return strings such as "Herr" and "Frau"
160 (for German-language locales).
161 (Other element names are listed in
165 This category determines the formatting rules used for nonmonetary
166 numeric values\[em]for example,
167 the thousands separator and the radix character
168 (a period in most English-speaking countries,
169 but a comma in many other regions).
170 It affects functions such as
175 This information can also be read with the
179 .BR LC_PAPER " (GNU extension, since glibc 2.2)"
180 .\" See ISO/IEC Technical Report 14652
181 Change the settings relating to the dimensions of the standard paper size
182 (e.g., US letter versus A4).
183 Applications that need the dimensions can obtain them by using
185 to retrieve the nonstandard
189 elements, which return
191 values specifying the dimensions in millimeters.
193 .BR LC_TELEPHONE " (GNU extension, since glibc 2.2)"
194 .\" See ISO/IEC Technical Report 14652
195 Change settings that describe the formats to be used with telephone services.
196 Applications that need this information can use
198 to retrieve nonstandard elements, such as
199 .B _NL_TELEPHONE_INT_PREFIX
200 (international prefix used to call numbers in this locale),
201 which returns a string such as "49" (for Germany).
202 (Other element names are listed in
206 This category governs the formatting used for date and time values.
207 For example, most of Europe uses a 24-hour clock versus the
208 12-hour clock used in the United States.
209 The setting of this category affects the behavior of functions such as
217 If the second argument to
221 for the default locale, it is determined using the following steps:
223 If there is a non-null environment variable
229 If an environment variable with the same name as one of the categories
230 above exists and is non-null, its value is used for that category.
232 If there is a non-null environment variable
238 Values about local numeric formatting is made available in a
242 function, which has the following declaration:
248 /* Numeric (nonmonetary) information */
250 char *decimal_point; /* Radix character */
251 char *thousands_sep; /* Separator for digit groups to left
252 of radix character */
253 char *grouping; /* Each element is the number of digits in
254 a group; elements with higher indices
255 are further left. An element with value
256 CHAR_MAX means that no further grouping
257 is done. An element with value 0 means
258 that the previous element is used for
259 all groups further left. */
261 /* Remaining fields are for monetary information */
263 char *int_curr_symbol; /* First three chars are a currency
264 symbol from ISO 4217. Fourth char
265 is the separator. Fifth char
267 char *currency_symbol; /* Local currency symbol */
268 char *mon_decimal_point; /* Radix character */
269 char *mon_thousands_sep; /* Like \fIthousands_sep\fP above */
270 char *mon_grouping; /* Like \fIgrouping\fP above */
271 char *positive_sign; /* Sign for positive values */
272 char *negative_sign; /* Sign for negative values */
273 char int_frac_digits; /* International fractional digits */
274 char frac_digits; /* Local fractional digits */
275 char p_cs_precedes; /* 1 if currency_symbol precedes a
276 positive value, 0 if succeeds */
277 char p_sep_by_space; /* 1 if a space separates
278 currency_symbol from a positive
280 char n_cs_precedes; /* 1 if currency_symbol precedes a
281 negative value, 0 if succeeds */
282 char n_sep_by_space; /* 1 if a space separates
283 currency_symbol from a negative
285 /* Positive and negative sign positions:
286 0 Parentheses surround the quantity and currency_symbol.
287 1 The sign string precedes the quantity and currency_symbol.
288 2 The sign string succeeds the quantity and currency_symbol.
289 3 The sign string immediately precedes the currency_symbol.
290 4 The sign string immediately succeeds the currency_symbol. */
296 .SS POSIX.1-2008 extensions to the locale API
297 POSIX.1-2008 standardized a number of extensions to the locale API,
298 based on implementations that first appeared in glibc 2.3.
299 These extensions are designed to address the problem that
300 the traditional locale APIs do not mix well with multithreaded applications
301 and with applications that must deal with multiple locales.
303 The extensions take the form of new functions for creating and
304 manipulating locale objects
310 and various new library functions with the suffix "_l" (e.g.,
312 that extend the traditional locale-dependent APIs (e.g.,
314 to allow the specification of a locale object that should apply when
315 executing the function.
317 The following environment variable is used by
321 and thus affects all unprivileged localized programs:
324 A list of pathnames, separated by colons (\[aq]:\[aq]),
325 that should be used to find locale data.
326 If this variable is set,
327 only the individual compiled locale data files from
329 and the system default locale data path are used;
330 any available locale archives are not used (see
332 The individual compiled locale data files are searched for under
333 subdirectories which depend on the currently used locale.
336 is used for a category, the following subdirectories are searched for,
347 .I /usr/lib/locale/locale\-archive
348 Usual default locale archive location.
351 Usual default path for compiled individual locale files.
355 .\" The GNU gettext functions are specified in LI18NUX2000.