Penguin
Blame: setlocale(3)
EditPageHistoryDiffInfoLikePages
Annotated edit history of setlocale(3) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 SETLOCALE
2 !!!SETLOCALE
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 CONFORMING TO
8 NOTES
9 SEE ALSO
10 ----
11 !!NAME
12
13
14 setlocale - set the current locale.
15 !!SYNOPSIS
16
17
18 __#include
19 __ ''category''__, const char *__ ''locale''__);
20 __
21 !!DESCRIPTION
22
23
24 The __setlocale()__ function is used to set or query the
25 program's current locale.
26
27
28 If ''locale'' is not __NULL__, the program's current
29 locale is modified according to the arguments. The argument
30 ''category'' determines which parts of the program's
31 current locale should be modified.
32
33
34 __LC_ALL__
35
36
37 for all of the locale.
38
39
40 __LC_COLLATE__
41
42
43 for regular expression matching (it determines the meaning
44 of range expressions and equivalence classes) and string
45 collation.
46
47
48 __LC_CTYPE__
49
50
51 for regular expression matching, character classification,
52 conversion, case-sensitive comparison, and wide character
53 functions.
54
55
56 __LC_MESSAGES__
57
58
59 for localizable natural-language messages.
60
61
62 __LC_MONETARY__
63
64
65 for monetary formatting.
66
67
68 __LC_NUMERIC__
69
70
71 for number formatting (such as the decimal point and the
72 thousands separator).
73
74
75 __LC_TIME__
76
77
78 for time and date formatting.
79
80
81 The argument ''locale'' is a pointer to a character
82 string containing the required setting of ''category''.
83 Such a string is either a well-known constant like
84 ''setlocale__.
85
86
87 If ''locale'' is ____, each part of the
88 locale that should be modified is set according to the
89 environment variables. The details are implementation
90 dependent. For glibc, first (regardless of ''category''),
91 the environment variable LC_ALL is inspected, next the
92 environment variable with the same name as the category
93 (LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC,
94 LC_TIME) and finally the environment variable LANG. The
95 first existing environment variable is used. If its value is
96 not a valid locale specification, the locale is unchanged,
97 and __setlocale__ returns NULL.
98
99
100 The locale ____ or ____
101 is a portable locale; its LC_CTYPE part corresponds to the
102 7-bit ASCII character set.
103
104
105 A locale name is typically of the form
106 ''language''[[_''territory''][[.''codeset''][[@''modifier''],
107 where ''language'' is an ISO 639 language code,
108 ''territory'' is an ISO 3166 country code, and
109 ''codeset'' is a character set or encoding identifier
110 like __ISO-8859-1__ or __UTF-8__. For a list of all
111 supported locales, try
112 locale(1).
113
114
115 If ''locale'' is __NULL__, the current locale is only
116 queried, not modified.
117
118
119 On startup of the main program, the portable
120 ____ locale is selected as default. A
121 program may be made portable to all locales by calling
122 __setlocale(LC_ALL, __ after program
123 initialization, by using the values returned from a
124 __localeconv()__ call for locale - dependent information,
125 by using the multi-byte and wide character functions for
126 text processing if __MB_CUR_MAX __, and by using
127 __strcoll()__, __wcscoll()__ or __strxfrm()__,
128 __wcsxfrm()__ to compare strings.
129 !!RETURN VALUE
130
131
132 A successful call to __setlocale()__ returns an opaque
133 string that corresponds to the locale set. This string may
134 be allocated in static storage. The string returned is such
135 that a subsequent call with that string and its associated
136 category will restore that part of the process's locale. The
137 return value is __NULL__ if the request cannot be
138 honored.
139 !!CONFORMING TO
140
141
142 ANSI C, POSIX.1
143 !!NOTES
144
145
146 Linux (that is, GNU libc) supports the portable locales
147 ____ and ____. In the
148 good old days there used to be support for the European
149 Latin-1 ____ locale (e.g. in
150 libc-4.5.21 and libc-4.6.27), and the Russian
151 ____ (more precisely,
152 __
153 !!SEE ALSO
154
155
156 locale(1), localedef(1), strcoll(3),
157 isalpha(3), localeconv(3), strftime(3),
158 charsets(4), locale(7)
159 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.