2 @chapter Locale (@file
{locale.h
})
4 A @dfn
{locale
} is the name for a collection of parameters (affecting
5 collating sequences and formatting conventions) that may be different
6 depending on location or culture. The @code
{"C"
} locale is the only
7 one defined in the ANSI C standard.
9 This is a minimal implementation, supporting only the required @code
{"C"
}
10 value for locale; strings representing other locales are not
11 honored. (@code
{""
} is also accepted; it represents the default locale
12 for an implementation, here equivalent to @code
{"C"
}.
15 @file
{locale.h
} defines the structure @code
{lconv
} to collect the
16 information on a locale, with the following fields:
19 @item char *decimal_point
20 The decimal point character used to format ``ordinary'' numbers (all
21 numbers except those referring to amounts of money). @code
{"."
} in the
24 @item char *thousands_sep
25 The character (if any) used to separate groups of digits, when
26 formatting ordinary numbers.
27 @code
{""
} in the C locale.
30 Specifications for how many digits to group (if any grouping is done at
31 all) when formatting ordinary numbers. The @emph
{numeric value
} of each
32 character in the string represents the number of digits for the next
33 group, and a value of @code
{0} (that is, the string's trailing
34 @code
{NULL
}) means to continue grouping digits using the last value
35 specified. Use @code
{CHAR_MAX
} to indicate that no further grouping is
36 desired. @code
{""
} in the C locale.
38 @item char *int_curr_symbol
39 The international currency symbol (first three characters), if any, and
40 the character used to separate it from numbers.
41 @code
{""
} in the C locale.
43 @item char *currency_symbol
44 The local currency symbol, if any.
45 @code
{""
} in the C locale.
47 @item char *mon_decimal_point
48 The symbol used to delimit fractions in amounts of money.
49 @code
{""
} in the C locale.
51 @item char *mon_thousands_sep
52 Similar to @code
{thousands_sep
}, but used for amounts of money.
53 @code
{""
} in the C locale.
55 @item char *mon_grouping
56 Similar to @code
{grouping
}, but used for amounts of money.
57 @code
{""
} in the C locale.
59 @item char *positive_sign
60 A string to flag positive amounts of money when formatting.
61 @code
{""
} in the C locale.
63 @item char *negative_sign
64 A string to flag negative amounts of money when formatting.
65 @code
{""
} in the C locale.
67 @item char int_frac_digits
68 The number of digits to display when formatting amounts of money to
69 international conventions.
70 @code
{CHAR_MAX
} (the largest number representable as a @code
{char
}) in
73 @item char frac_digits
74 The number of digits to display when formatting amounts of money to
76 @code
{CHAR_MAX
} in the C locale.
78 @item char p_cs_precedes
79 @code
{1} indicates the local currency symbol is used before a
80 @emph
{positive or zero
} formatted amount of money; @code
{0} indicates
81 the currency symbol is placed after the formatted number.
82 @code
{CHAR_MAX
} in the C locale.
84 @item char p_sep_by_space
85 @code
{1} indicates the local currency symbol must be separated from
86 @emph
{positive or zero
} numbers by a space; @code
{0} indicates that it
87 is immediately adjacent to numbers.
88 @code
{CHAR_MAX
} in the C locale.
90 @item char n_cs_precedes
91 @code
{1} indicates the local currency symbol is used before a
92 @emph
{negative
} formatted amount of money; @code
{0} indicates
93 the currency symbol is placed after the formatted number.
94 @code
{CHAR_MAX
} in the C locale.
96 @item char n_sep_by_space
97 @code
{1} indicates the local currency symbol must be separated from
98 @emph
{negative
} numbers by a space; @code
{0} indicates that it
99 is immediately adjacent to numbers.
100 @code
{CHAR_MAX
} in the C locale.
102 @item char p_sign_posn
103 Controls the position of the @emph
{positive
} sign for
104 numbers representing money. @code
{0} means parentheses surround the
105 number; @code
{1} means the sign is placed before both the number and the
106 currency symbol; @code
{2} means the sign is placed after both the number
107 and the currency symbol; @code
{3} means the sign is placed just before
108 the currency symbol; and @code
{4} means the sign is placed just after
110 @code
{CHAR_MAX
} in the C locale.
112 @item char n_sign_posn
113 Controls the position of the @emph
{negative
} sign for numbers
114 representing money, using the same rules as @code
{p_sign_posn
}.
115 @code
{CHAR_MAX
} in the C locale.
119 * setlocale:: Select or query locale
123 @include locale/locale.def