Name
locale — Description of multi-language support
DESCRIPTION
A locale is a set of language and cultural rules. These
cover aspects such as language for messages, different
character sets, lexicographic conventions, etc. A program
needs to be able to determine its locale and act accordingly
to be portable to different cultures.
The header <locale.h> declares
data types, functions and macros which are useful in this
task.
The functions it declares are setlocale(3) to set the
current locale, and localeconv(3) to get
information about number formatting.
There are different categories for local information a
program might need; they are declared as macros. Using them
as the first argument to the setlocale(3) function, it
is possible to set one of these to the desired locale:
LC_COLLATE
-
This is used to change the behaviour of the
functions strcoll(3) and
strxfrm(3), which are
used to compare strings in the local alphabet. For
example, the German sharp s is sorted as "ss".
LC_CTYPE
-
This changes the behaviour of the character handling
and classification functions, such as isupper(3) and
toupper(3), and the
multi−byte character functions such as mblen(3) or wctomb(3).
LC_MONETARY
-
changes the information returned by localeconv(3) which
describes the way numbers are usually printed, with
details such as decimal point versus decimal comma.
This information is internally used by the function
strfmon(3).
LC_MESSAGES
-
changes the language messages are displayed in and
how an affirmative or negative answer looks like. The
GNU C-library contains the gettext(3), ngettext(3), and rpmatch(3) functions
to ease the use of these information. The GNU gettext
family of functions also obey the environment variable
LANGUAGE.
LC_NUMERIC
-
changes the information used by the printf(3) and
scanf(3) family of
functions, when they are advised to use the
locale-settings. This information can also be read with
the localeconv(3)
function.
LC_TIME
-
changes the behaviour of the strftime(3) function
to display the current time in a locally acceptable
form; for example, most of Europe uses a 24−hour
clock versus the 12−hour clock used in the United
States.
LC_ALL
-
All of the above.
If the second argument to setlocale(3) is empty
string, "", for the
default locale, it is determined using the following
steps:
-
If there is a non-null environment variable
LC_ALL, the value of
LC_ALL is used.
-
If an environment variable with the same name as one
of the categories above exists and is non-null, its
value is used for that category.
-
If there is a non-null environment variable
LANG, the value of
LANG is used.
Values about local numeric formatting is made available in
a struct lconv
returned by the localeconv(3) function,
which has the following declaration:
CONFORMING TO
POSIX.1-2001.
The GNU gettext functions are specified in
LI18NUX2000.
SEE ALSO
locale(1), localedef(1), gettext(3), localeconv(3), ngettext(3), nl_langinfo(3), rpmatch(3), setlocale(3), strcoll(3), strfmon(3), strftime(3), strxfrm(3)
(c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Since the Linux kernel and libraries are constantly changing, this
manual page may be incorrect or out-of-date. The author(s) assume no
responsibility for errors or omissions, or for damages resulting from
the use of the information contained herein. The author(s) may not
have taken the same level of care in the production of this manual,
which is licensed free of charge, as they might when working
professionally.
Formatted or processed versions of this manual, if unaccompanied by
the source, must acknowledge the copyright and authors of this work.
Modified Sat Jul 24 17:28:34 1993 by Rik Faith <faith@cs.unc.edu>
Modified Sun Jun 01 17:16:34 1997 by Jochen Hein
<jochen.hein@delphi.central.de>
Modified Thu Apr 25 00:43:19 2002 by Bruno Haible <bruno@clisp.org>
|