]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man1/locale.1
8b86f6f1c20c2d7dbbb32c87b79f6dd934e09999
[thirdparty/man-pages.git] / man1 / locale.1
1 .\" Copyright (C) 2014 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .TH LOCALE 1 2021-03-22 "Linux man-pages (unreleased)" "Linux User Manual"
6 .SH NAME
7 locale \- get locale-specific information
8 .SH SYNOPSIS
9 .nf
10 .BR locale " [\fIoption\fP]"
11 .BR locale " [\fIoption\fP] " \-a
12 .BR locale " [\fIoption\fP] " \-m
13 .BR locale " [\fIoption\fP] \fIname\fP..."
14 .fi
15 .SH DESCRIPTION
16 The
17 .B locale
18 command displays information about the current locale, or all locales,
19 on standard output.
20 .PP
21 When invoked without arguments,
22 .B locale
23 displays the current locale settings for each locale category (see
24 .BR locale (5)),
25 based on the settings of the environment variables that control the locale
26 (see
27 .BR locale (7)).
28 Values for variables set in the environment are printed without double
29 quotes, implied values are printed with double quotes.
30 .PP
31 If either the
32 .B \-a
33 or the
34 .B \-m
35 option (or one of their long-format equivalents) is specified,
36 the behavior is as follows:
37 .TP
38 .BR \-a ", " \-\-all\-locales
39 Display a list of all available locales.
40 The
41 .B \-v
42 option causes the
43 .B LC_IDENTIFICATION
44 metadata about each locale to be included in the output.
45 .TP
46 .BR \-m ", " \-\-charmaps
47 Display the available charmaps (character set description files).
48 To display the current character set for the locale, use
49 \fBlocale \-c charmap\fR.
50 .PP
51 The
52 .B locale
53 command can also be provided with one or more arguments,
54 which are the names of locale keywords (for example,
55 .IR date_fmt ,
56 .IR ctype\-class\-names ,
57 .IR yesexpr ,
58 or
59 .IR decimal_point )
60 or locale categories (for example,
61 .B LC_CTYPE
62 or
63 .BR LC_TIME ).
64 For each argument, the following is displayed:
65 .IP * 3
66 For a locale keyword, the value of that keyword to be displayed.
67 .IP *
68 For a locale category,
69 the values of all keywords in that category are displayed.
70 .PP
71 When arguments are supplied, the following options are meaningful:
72 .TP
73 .BR \-c ", " \-\-category\-name
74 For a category name argument,
75 write the name of the locale category
76 on a separate line preceding the list of keyword values for that category.
77 .IP
78 For a keyword name argument,
79 write the name of the locale category for this keyword
80 on a separate line preceding the keyword value.
81 .IP
82 This option improves readability when multiple name arguments are specified.
83 It can be combined with the
84 .B \-k
85 option.
86 .TP
87 .BR \-k ", " \-\-keyword\-name
88 For each keyword whose value is being displayed,
89 include also the name of that keyword,
90 so that the output has the format:
91 .IP
92 .in +4n
93 .EX
94 .IR keyword =\(dq value \(dq
95 .EE
96 .in
97 .PP
98 The
99 .B locale
100 command also knows about the following options:
101 .TP
102 .BR \-v ", " \-\-verbose
103 Display additional information for some command-line option and argument
104 combinations.
105 .TP
106 .BR \-? ", " \-\-help
107 Display a summary of command-line options and arguments and exit.
108 .TP
109 .B \-\-usage
110 Display a short usage message and exit.
111 .TP
112 .BR \-V ", " \-\-version
113 Display the program version and exit.
114 .SH FILES
115 .TP
116 .I /usr/lib/locale/locale\-archive
117 Usual default locale archive location.
118 .TP
119 .I /usr/share/i18n/locales
120 Usual default path for locale definition files.
121 .SH STANDARDS
122 POSIX.1-2001, POSIX.1-2008.
123 .SH EXAMPLES
124 .EX
125 $ \fBlocale\fP
126 LANG=en_US.UTF\-8
127 LC_CTYPE="en_US.UTF\-8"
128 LC_NUMERIC="en_US.UTF\-8"
129 LC_TIME="en_US.UTF\-8"
130 LC_COLLATE="en_US.UTF\-8"
131 LC_MONETARY="en_US.UTF\-8"
132 LC_MESSAGES="en_US.UTF\-8"
133 LC_PAPER="en_US.UTF\-8"
134 LC_NAME="en_US.UTF\-8"
135 LC_ADDRESS="en_US.UTF\-8"
136 LC_TELEPHONE="en_US.UTF\-8"
137 LC_MEASUREMENT="en_US.UTF\-8"
138 LC_IDENTIFICATION="en_US.UTF\-8"
139 LC_ALL=
140
141 $ \fBlocale date_fmt\fP
142 %a %b %e %H:%M:%S %Z %Y
143
144 $ \fBlocale \-k date_fmt\fP
145 date_fmt="%a %b %e %H:%M:%S %Z %Y"
146
147 $ \fBlocale \-ck date_fmt\fP
148 LC_TIME
149 date_fmt="%a %b %e %H:%M:%S %Z %Y"
150
151 $ \fBlocale LC_TELEPHONE\fP
152 +%c (%a) %l
153 (%a) %l
154 11
155 1
156 UTF\-8
157
158 $ \fBlocale \-k LC_TELEPHONE\fP
159 tel_int_fmt="+%c (%a) %l"
160 tel_dom_fmt="(%a) %l"
161 int_select="11"
162 int_prefix="1"
163 telephone\-codeset="UTF\-8"
164 .EE
165 .PP
166 The following example compiles a custom locale from the
167 .I ./wrk
168 directory with the
169 .BR localedef (1)
170 utility under the
171 .I $HOME/.locale
172 directory, then tests the result with the
173 .BR date (1)
174 command, and then sets the environment variables
175 .B LOCPATH
176 and
177 .B LANG
178 in the shell profile file so that the custom locale will be used in the
179 subsequent user sessions:
180 .PP
181 .EX
182 $ \fBmkdir \-p $HOME/.locale\fP
183 $ \fBI18NPATH=./wrk/ localedef \-f UTF\-8 \-i fi_SE $HOME/.locale/fi_SE.UTF\-8\fP
184 $ \fBLOCPATH=$HOME/.locale LC_ALL=fi_SE.UTF\-8 date\fP
185 $ \fBecho "export LOCPATH=\e$HOME/.locale" >> $HOME/.bashrc\fP
186 $ \fBecho "export LANG=fi_SE.UTF\-8" >> $HOME/.bashrc\fP
187 .EE
188 .SH SEE ALSO
189 .BR localedef (1),
190 .BR charmap (5),
191 .BR locale (5),
192 .BR locale (7)