1#
2#Copyright (c) 1996 - 2002 FreeBSD Project
3#Copyright (c) 1991, 1993
4#The Regents of the University of California.  All rights reserved.
5#
6#Redistribution and use in source and binary forms, with or without
7#modification, are permitted provided that the following conditions
8#are met:
9#1. Redistributions of source code must retain the above copyright
10#notice, this list of conditions and the following disclaimer.
11#2. Redistributions in binary form must reproduce the above copyright
12#notice, this list of conditions and the following disclaimer in the
13#documentation and/or other materials provided with the distribution.
14#4. Neither the name of the University nor the names of its contributors
15#may be used to endorse or promote products derived from this software
16#without specific prior written permission.
17#
18#THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21#ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24#OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25#HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26#LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27#OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28#SUCH DAMAGE.
29#
30@node Locale
31@chapter Locale (@file{locale.h})
32
33A @dfn{locale} is the name for a collection of parameters (affecting
34collating sequences and formatting conventions) that may be different
35depending on location or culture.  The @code{"C"} locale is the only
36one defined in the ANSI C standard.
37
38This is a minimal implementation, supporting only the required @code{"C"}
39value for locale; strings representing other locales are not
40honored.  (@code{""} is also accepted; it represents the default locale
41for an implementation, here equivalent to @code{"C"}).
42
43
44@file{locale.h} defines the structure @code{lconv} to collect the
45information on a locale, with the following fields:
46
47@table @code
48@item char *decimal_point
49The decimal point character used to format ``ordinary'' numbers (all
50numbers except those referring to amounts of money).  @code{"."} in the
51C locale.
52
53@item char *thousands_sep
54The character (if any) used to separate groups of digits, when
55formatting ordinary numbers.
56@code{""} in the C locale.
57
58@item char *grouping
59Specifications for how many digits to group (if any grouping is done at
60all) when formatting ordinary numbers.  The @emph{numeric value} of each
61character in the string represents the number of digits for the next
62group, and a value of @code{0} (that is, the string's trailing
63@code{NULL}) means to continue grouping digits using the last value
64specified.  Use @code{CHAR_MAX} to indicate that no further grouping is
65desired.  @code{""} in the C locale.
66
67@item char *int_curr_symbol
68The international currency symbol (first three characters), if any, and
69the character used to separate it from numbers.
70@code{""} in the C locale.
71
72@item char *currency_symbol
73The local currency symbol, if any.
74@code{""} in the C locale.
75
76@item char *mon_decimal_point
77The symbol used to delimit fractions in amounts of money.
78@code{""} in the C locale.
79
80@item char *mon_thousands_sep
81Similar to @code{thousands_sep}, but used for amounts of money.
82@code{""} in the C locale.
83
84@item char *mon_grouping
85Similar to @code{grouping}, but used for amounts of money.
86@code{""} in the C locale.
87
88@item char *positive_sign
89A string to flag positive amounts of money when formatting.
90@code{""} in the C locale.
91
92@item char *negative_sign
93A string to flag negative amounts of money when formatting.
94@code{""} in the C locale.
95
96@item char int_frac_digits
97The number of digits to display when formatting amounts of money to
98international conventions.
99@code{CHAR_MAX} (the largest number representable as a @code{char}) in
100the C locale.
101
102@item char frac_digits
103The number of digits to display when formatting amounts of money to
104local conventions.
105@code{CHAR_MAX} in the C locale.
106
107@item char p_cs_precedes
108@code{1} indicates the local currency symbol is used before a
109@emph{positive or zero} formatted amount of money; @code{0} indicates
110the currency symbol is placed after the formatted number.
111@code{CHAR_MAX} in the C locale.
112
113@item char p_sep_by_space
114@code{1} indicates the local currency symbol must be separated from
115@emph{positive or zero} numbers by a space; @code{0} indicates that it
116is immediately adjacent to numbers.
117@code{CHAR_MAX} in the C locale.
118
119@item char n_cs_precedes
120@code{1} indicates the local currency symbol is used before a
121@emph{negative} formatted amount of money; @code{0} indicates
122the currency symbol is placed after the formatted number.
123@code{CHAR_MAX} in the C locale.
124
125@item char n_sep_by_space
126@code{1} indicates the local currency symbol must be separated from
127@emph{negative} numbers by a space; @code{0} indicates that it
128is immediately adjacent to numbers.
129@code{CHAR_MAX} in the C locale.
130
131@item char p_sign_posn
132Controls the position of the @emph{positive} sign for
133numbers representing money.  @code{0} means parentheses surround the
134number; @code{1} means the sign is placed before both the number and the
135currency symbol; @code{2} means the sign is placed after both the number
136and the currency symbol; @code{3} means the sign is placed just before
137the currency symbol; and @code{4} means the sign is placed just after
138the currency symbol.
139@code{CHAR_MAX} in the C locale.
140
141@item char n_sign_posn
142Controls the position of the @emph{negative} sign for numbers
143representing money, using the same rules as @code{p_sign_posn}.
144@code{CHAR_MAX} in the C locale.
145@end table
146
147@menu
148* setlocale::  Select or query locale
149@end menu
150
151@page
152@include locale/locale.def
153