1locale(1)                        User Commands                       locale(1)
2
3
4

NAME

6       locale - get locale-specific information
7

SYNOPSIS

9       locale [-a | -m]
10
11
12       locale [-ck] name...
13
14

DESCRIPTION

16       The locale utility writes information about the current locale environ‐
17       ment, or all public locales, to the standard output. For  the  purposes
18       of  this section, a public locale is one provided by the implementation
19       that is accessible to the application.
20
21
22       When locale is invoked without any arguments, it summarizes the current
23       locale  environment  for each locale category as determined by the set‐
24       tings of the environment variables.
25
26
27       When invoked with operands, it writes values that have been assigned to
28       the keywords in the locale categories, as follows:
29
30           o      Specifying  a keyword name selects the named keyword and the
31                  category containing that keyword.
32
33           o      Specifying a category name selects the  named  category  and
34                  all keywords in that category.
35

OPTIONS

37       The following options are supported:
38
39       -a    Writes information about all available public locales. The avail‐
40             able locales include POSIX, representing the POSIX locale.
41
42
43       -c    Writes the names of selected locale  categories.  The  -c  option
44             increases  readability  when  more  than one category is selected
45             (for example, via more than one keyword name or  via  a  category
46             name). It is valid both with and without the -k option.
47
48
49       -k    Writes the names and values of selected keywords. The implementa‐
50             tion may omit values for some keywords; see OPERANDS.
51
52
53       -m    Writes names of available charmaps; see  localedef(1).
54
55

OPERANDS

57       The following operand is supported:
58
59       name    The name of a locale category, the  name  of  a  keyword  in  a
60               locale  category, or the reserved name charmap. The named cate‐
61               gory or keyword will be selected for output. If a  single  name
62               represents  both  a  locale category name and a keyword name in
63               the current locale, the  results  are  unspecified;  otherwise,
64               both  category and keyword names can be specified as name oper‐
65               ands, in any sequence.
66
67

EXAMPLES

69       Example 1 Examples of the locale utility
70
71
72       In the following examples, the assumption is  that  locale  environment
73       variables are set as follows:
74
75
76         LANG=locale_x LC_COLLATE=locale_y
77
78
79
80
81       The command locale would result in the following output:
82
83
84         LANG=locale_x
85         LC_CTYPE="locale_x"
86         LC_NUMERIC="locale_x"
87         LC_TIME="locale_x"
88         LC_COLLATE=locale_y
89         LC_MONETARY="locale_x"
90         LC_MESSAGES="locale_x"
91         LC_ALL=
92
93
94
95
96       The command
97
98
99         LC_ALL=POSIX locale -ck decimal_point
100
101
102
103
104       would produce:
105
106
107         LC_NUMERIC
108         decimal_point="."
109
110
111
112
113       The  following  command  shows  an  application  of locale to determine
114       whether a user-supplied response is affirmative:
115
116
117         if printf "%s\n" "$response" | /usr/xpg4/bin/grep -Eq\
118                 "$(locale yesexpr)"
119         then
120             affirmative processing goes here
121         else
122             non-affirmative processing goes here
123         fi
124
125
126

ENVIRONMENT VARIABLES

128       See environ(5) for the descriptions of  LANG, LC_ALL, LC_CTYPE, LC_MES‐
129       SAGES, and NLSPATH.
130
131
132       The LANG, LC_*, and NLSPATH environment variables must specify the cur‐
133       rent locale environment to be written out. These environment  variables
134       will be used if the -a option is not specified.
135

EXIT STATUS

137       The following exit values are returned:
138
139       0     All the requested information was found and output successfully.
140
141
142       >0    An error occurred.
143
144

ATTRIBUTES

146       See attributes(5) for descriptions of the following attributes:
147
148
149
150
151       ┌─────────────────────────────┬─────────────────────────────┐
152       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
153       ├─────────────────────────────┼─────────────────────────────┤
154       │Availability                 │SUNWloc                      │
155       ├─────────────────────────────┼─────────────────────────────┤
156       │CSI                          │Enabled                      │
157       ├─────────────────────────────┼─────────────────────────────┤
158       │Interface Stability          │Standard                     │
159       └─────────────────────────────┴─────────────────────────────┘
160

SEE ALSO

162       localedef(1),  attributes(5),  charmap(5), environ(5), locale(5), stan‐
163       dards(5)
164

NOTES

166       If LC_CTYPE or keywords in the category LC_CTYPE  are  specified,  only
167       the values in the range 0x00-0x7f are written out.
168
169
170       If  LC_COLLATE or keywords in the category LC_COLLATE are specified, no
171       actual values are written out.
172
173
174
175SunOS 5.11                        20 Dec 1996                        locale(1)
Impressum