Penguin
Annotated edit history of locale(7) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 LOCALE
2 !!!LOCALE
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 CONFORMS TO
7 SEE ALSO
8 ----
9 !!NAME
10
11
12 locale - Description of multi-language support
13 !!SYNOPSIS
14
15
16 __#include
17 __
18 !!DESCRIPTION
19
20
21 A locale is a set of language and cultural rules. These
22 cover aspects such as language for messages, different
23 character sets, lexigraphic conventions, etc. A program
24 needs to be able to determine its locale and act accordingly
25 to be portable to different cultures.
26
27
28 The header ____ declares data types,
29 functions and macros which are useful in this
30 task.
31
32
33 The functions it declares are __setlocale()__ to set the
34 current locale, and __localeconv()__ to get information
35 about number formatting.
36
37
38 There are different categories for local information a
39 program might need; they are declared as macros. Using them
40 as the first argument to the __setlocale()__ function, it
41 is possible to set one of these to the desired
42 locale:
43
44
45 __LC_COLLATE__
46
47
48 This is used to change the behaviour of the functions
49 __strcoll()__ and __strxfrm()__, which are used to
50 compare strings in the local alphabet. For example, the
51 German sharp s is sorted as __
52
53
54 __LC_CTYPE__
55
56
57 This changes the behaviour of the character handling and
58 classification functions, such as __isupper()__ and
59 __toupper()__, and the multi-byte character functions
60 such as __mblen()__ or __wctomb()__.
61
62
63 __LC_MONETARY__
64
65
66 changes the information returned by __localeconv()__
67 which describes the way numbers are usually printed, with
68 details such as decimal point versus decimal comma. This
69 information is internally used by the function
70 __strfmon()__.
71
72
73 __LC_MESSAGES__
74
75
76 changes the language messages are displayed in and how an
77 affirmative or negative answer looks like. The GNU C-library
78 contains the __rpmatch()__ function to ease the use of
79 these information.
80
81
82 __LC_NUMERIC__
83
84
85 changes the information used by the __printf()__ and
86 __scanf()__ family of functions, when they are advised to
87 use the locale-settings. This information can also be read
88 with the __localeconv()__ function.
89
90
91 __LC_TIME__
92
93
94 changes the behaviour of the __strftime()__ function to
95 display the current time in a locally acceptable form; for
96 example, most of Europe uses a 24-hour clock vs. the US'
97 12-hour clock.
98
99
100 __LC_ALL__
101
102
103 All of the above.
104
105
106 If the second argument to __setlocale()__ is empty
107 string, ____, for the default locale, it is
108 determined using the following steps:
109
110
111 1.
112
113
114 If there is a non-null environment variable __LC_ALL__,
115 the value of __LC_ALL__ is used.
116
117
118 2.
119
120
121 If an environment variable with the same name as one of the
122 categories above exists and is non-null, its value is used
123 for that category.
124
125
126 3.
127
128
129 If there is a non-null environment variable __LANG__, the
130 value of __LANG__ is used.
131
132
133 Values about local numeric formatting is made available in a
134 __struct lconv__ returned by the __localeconv()__
135 function, which has the following declaration:
136
137
138 struct lconv
139 {
140 /* Numeric (non-monetary) information. */
141 char *decimal_point; /* Decimal point character. */
142 char *thousands_sep; /* Thousands separator. */
143 /* Each element is the number of digits in each group;
144 elements with higher indices are farther left.
145 An element with value CHAR_MAX means that no further grouping is done.
146 An element with value 0 means that the previous element is used
147 for all groups farther left. */
148 char *grouping;
149 /* Monetary information. */
150 /* First three chars are a currency symbol from ISO 4217.
151 Fourth char is the separator. Fifth char is ' '. */
152 char *int_curr_symbol;
153 char *currency_symbol; /* Local currency symbol. */
154 char *mon_decimal_point; /* Decimal point character. */
155 char *mon_thousands_sep; /* Thousands separator. */
156 char *mon_grouping; /* Like `grouping' element (above). */
157 char *positive_sign; /* Sign for positive values. */
158 char *negative_sign; /* Sign for negative values. */
159 char int_frac_digits; /* Int'l fractional digits. */
160 char frac_digits; /* Local fractional digits. */
161 /* 1 if currency_symbol precedes a positive value, 0 if succeeds. */
162 char p_cs_precedes;
163 /* 1 if a space separates currency_symbol from a positive value. */
164 char p_sep_by_space;
165 /* 1 if currency_symbol precedes a negative value, 0 if succeeds. */
166 char n_cs_precedes;
167 /* 1 if a space separates currency_symbol from a negative value. */
168 char n_sep_by_space;
169 /* Positive and negative sign positions:
170 0 Parentheses surround the quantity and currency_symbol.
171 1 The sign string precedes the quantity and currency_symbol.
172 2 The sign string succeeds the quantity and currency_symbol.
173 3 The sign string immediately precedes the currency_symbol.
174 4 The sign string immediately succeeds the currency_symbol. */
175 char p_sign_posn;
176 char n_sign_posn;
177 };
178 !!CONFORMS TO
179
180
181 POSIX.1
182 !!SEE ALSO
183
184
185 setlocale(3), localeconv(3), locale(1),
186 localedef(1), rpmatch(3), strfmon(3),
187 strcoll(3), strxfrm(3),
188 strftime(3)
189 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.