2008-07-08 14:32:54 +00:00
|
|
|
.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
|
2004-11-03 13:51:07 +00:00
|
|
|
.\"
|
|
|
|
.\" 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.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" 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.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" 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>
|
|
|
|
.\"
|
2008-12-05 23:38:30 +00:00
|
|
|
.TH LOCALE 7 2008-12-05 "Linux" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
getaddrinfo.3, setlocale.3, strchr.3, wctob.3, st.4, glob.7, locale.7, regex.7, standards.7, unicode.7, utf-8.7: Global fix: s/multi-/multi/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "multi-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 17:47:55 +00:00
|
|
|
locale \- Description of multilanguage support
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <locale.h>
|
|
|
|
.fi
|
|
|
|
.SH DESCRIPTION
|
2007-04-12 22:42:49 +00:00
|
|
|
A locale is a set of language and cultural rules.
|
|
|
|
These cover aspects
|
2006-05-29 01:20:08 +00:00
|
|
|
such as language for messages, different character sets, lexicographic
|
2007-04-12 22:42:49 +00:00
|
|
|
conventions, etc.
|
|
|
|
A program needs to be able to determine its locale
|
2004-11-03 13:51:07 +00:00
|
|
|
and act accordingly to be portable to different cultures.
|
|
|
|
.PP
|
|
|
|
The header
|
2005-11-03 12:47:27 +00:00
|
|
|
.I <locale.h>
|
2004-11-03 13:51:07 +00:00
|
|
|
declares data types, functions and macros which are useful in this
|
|
|
|
task.
|
|
|
|
.PP
|
|
|
|
The functions it declares are
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR setlocale (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
to set the current locale, and
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR localeconv (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
to get information about number formatting.
|
|
|
|
.PP
|
|
|
|
There are different categories for local information a program might
|
2007-04-12 22:42:49 +00:00
|
|
|
need; they are declared as macros.
|
|
|
|
Using them as the first argument
|
2004-11-03 13:51:07 +00:00
|
|
|
to the
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR setlocale (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
function, it is possible to set one of these to the desired locale:
|
|
|
|
.TP
|
|
|
|
.B LC_COLLATE
|
2007-06-08 09:56:56 +00:00
|
|
|
This is used to change the behavior of the functions
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR strcoll (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
and
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR strxfrm (3),
|
2007-04-12 22:42:49 +00:00
|
|
|
which are used to compare strings in the local alphabet.
|
|
|
|
For example,
|
2004-11-03 13:51:07 +00:00
|
|
|
the German sharp s is sorted as "ss".
|
|
|
|
.TP
|
|
|
|
.B LC_CTYPE
|
2007-06-08 09:56:56 +00:00
|
|
|
This changes the behavior of the character handling and
|
2004-11-03 13:51:07 +00:00
|
|
|
classification functions, such as
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR isupper (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
and
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR toupper (3),
|
getaddrinfo.3, setlocale.3, strchr.3, wctob.3, st.4, glob.7, locale.7, regex.7, standards.7, unicode.7, utf-8.7: Global fix: s/multi-/multi/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "multi-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 17:47:55 +00:00
|
|
|
and the multibyte character functions such as
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR mblen (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
or
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR wctomb (3).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B LC_MONETARY
|
|
|
|
changes the information returned by
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR localeconv (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
which describes the way numbers are usually printed, with details such
|
2007-04-12 22:42:49 +00:00
|
|
|
as decimal point versus decimal comma.
|
|
|
|
This information is internally
|
2004-11-03 13:51:07 +00:00
|
|
|
used by the function
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR strfmon (3).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B LC_MESSAGES
|
2007-08-27 12:54:48 +00:00
|
|
|
changes the language messages are displayed in and what an affirmative or
|
2007-04-12 22:42:49 +00:00
|
|
|
negative answer looks like.
|
|
|
|
The GNU C-library contains the
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR gettext (3),
|
|
|
|
.BR ngettext (3),
|
2004-11-03 13:51:07 +00:00
|
|
|
and
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR rpmatch (3)
|
2007-04-12 22:42:49 +00:00
|
|
|
functions to ease the use of these information.
|
|
|
|
The GNU gettext family of
|
2004-11-03 13:51:07 +00:00
|
|
|
functions also obey the environment variable
|
2008-12-05 23:38:30 +00:00
|
|
|
.BR LANGUAGE
|
|
|
|
(containing a colon-separated list of locales)
|
|
|
|
if the category is set to a valid locale other than
|
|
|
|
.BR """C""" .
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B LC_NUMERIC
|
|
|
|
changes the information used by the
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR printf (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
and
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR scanf (3)
|
2007-04-12 22:42:49 +00:00
|
|
|
family of functions, when they are advised to use the locale-settings.
|
|
|
|
This information can also be read with the
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR localeconv (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
function.
|
|
|
|
.TP
|
|
|
|
.B LC_TIME
|
2007-06-08 09:56:56 +00:00
|
|
|
changes the behavior of the
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR strftime (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
function to display the current time in a locally acceptable form; for
|
2007-12-26 08:00:10 +00:00
|
|
|
example, most of Europe uses a 24-hour clock versus the
|
|
|
|
12-hour clock used in the United States.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B LC_ALL
|
|
|
|
All of the above.
|
accept.2, execve.2, futimesat.2, getresuid.2, getrlimit.2, madvise.2, mq_getsetattr.2, msgctl.2, nice.2, open.2, poll.2, setresuid.2, shmctl.2, sigaction.2, times.2, utimensat.2, __setfpucw.3, atoi.3, endian.3, err.3, euidaccess.3, fenv.3, fopencookie.3, fpurge.3, getgrouplist.3, getutmp.3, j0.3, lgamma.3, netlink.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_cleanup_push_defer_np.3, pthread_getattr_np.3, pthread_kill_other_threads_np.3, pthread_setaffinity_np.3, pthread_tryjoin_np.3, pthread_yield.3, random_r.3, readdir.3, rtnetlink.3, scanf.3, setenv.3, significand.3, sigsetops.3, strerror.3, strstr.3, sysv_signal.3, termios.3, timegm.3, unlocked_stdio.3, y0.3, locale.5, bootparam.7, feature_test_macros.7, ip.7, locale.7, pthreads.7, rtld-audit.7, nscd.8: Global fix: s/non-standard/nonstandard/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:37:52 +00:00
|
|
|
.\" FIXME glibc 2.2.2 added new nonstandard locale categories:
|
2006-02-07 22:48:42 +00:00
|
|
|
.\" LC_ADDRESS, LC_IDENTIFICATION, LC_MEASUREMENT, LC_NAME,
|
|
|
|
.\" LC_PAPER, LC_TELEPHONE. These need to be documented.
|
2004-11-03 13:51:07 +00:00
|
|
|
.PP
|
|
|
|
If the second argument to
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR setlocale (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
is empty string,
|
|
|
|
.BR """""" ,
|
|
|
|
for the default locale, it is determined using the following steps:
|
|
|
|
.IP 1.
|
|
|
|
If there is a non-null environment variable
|
|
|
|
.BR LC_ALL ,
|
|
|
|
the value of
|
|
|
|
.B LC_ALL
|
|
|
|
is used.
|
|
|
|
.IP 2.
|
|
|
|
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.
|
|
|
|
.IP 3.
|
|
|
|
If there is a non-null environment variable
|
|
|
|
.BR LANG ,
|
|
|
|
the value of
|
|
|
|
.B LANG
|
|
|
|
is used.
|
|
|
|
.PP
|
|
|
|
Values about local numeric formatting is made available in a
|
2005-11-02 13:55:25 +00:00
|
|
|
.I struct lconv
|
2004-11-03 13:51:07 +00:00
|
|
|
returned by the
|
2007-05-11 23:29:44 +00:00
|
|
|
.BR localeconv (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
function, which has the following declaration:
|
2007-12-19 06:57:44 +00:00
|
|
|
.in +2n
|
2004-11-03 13:51:07 +00:00
|
|
|
.nf
|
|
|
|
|
2006-02-07 22:48:42 +00:00
|
|
|
struct lconv {
|
2006-02-07 23:22:43 +00:00
|
|
|
|
2010-01-16 17:31:36 +00:00
|
|
|
/* Numeric (nonmonetary) information */
|
2004-11-03 13:51:07 +00:00
|
|
|
|
2007-12-19 06:57:44 +00:00
|
|
|
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. */
|
2007-12-20 12:12:32 +00:00
|
|
|
|
2007-12-19 06:57:44 +00:00
|
|
|
/* Remaining fields are for monetary information */
|
2007-12-20 12:12:32 +00:00
|
|
|
|
2007-12-19 06:57:44 +00:00
|
|
|
char *int_curr_symbol; /* First three chars are a currency symbol
|
2008-06-05 20:14:50 +00:00
|
|
|
from ISO 4217. Fourth char is the
|
2008-06-09 15:49:35 +00:00
|
|
|
separator. Fifth char is \(aq\\0\(aq. */
|
2007-12-19 06:57:44 +00:00
|
|
|
char *currency_symbol; /* Local currency symbol */
|
|
|
|
char *mon_decimal_point; /* Radix character */
|
|
|
|
char *mon_thousands_sep; /* Like \fIthousands_sep\fP above */
|
|
|
|
char *mon_grouping; /* Like \fIgrouping\fP above */
|
|
|
|
char *positive_sign; /* Sign for positive values */
|
|
|
|
char *negative_sign; /* Sign for negative values */
|
2008-06-05 20:14:50 +00:00
|
|
|
char int_frac_digits; /* International fractional digits */
|
2007-12-19 06:57:44 +00:00
|
|
|
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;
|
2004-11-03 13:51:07 +00:00
|
|
|
};
|
|
|
|
.fi
|
2007-12-19 06:57:44 +00:00
|
|
|
.in
|
2006-08-04 12:39:17 +00:00
|
|
|
.SH "CONFORMING TO"
|
|
|
|
POSIX.1-2001.
|
2006-02-07 22:48:42 +00:00
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
The GNU gettext functions are specified in LI18NUX2000.
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR locale (1),
|
|
|
|
.BR localedef (1),
|
|
|
|
.BR gettext (3),
|
|
|
|
.BR localeconv (3),
|
|
|
|
.BR ngettext (3),
|
|
|
|
.BR nl_langinfo (3),
|
|
|
|
.BR rpmatch (3),
|
|
|
|
.BR setlocale (3),
|
|
|
|
.BR strcoll (3),
|
|
|
|
.BR strfmon (3),
|
|
|
|
.BR strftime (3),
|
|
|
|
.BR strxfrm (3)
|