1 .\" Copyright (C) 2014 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .TH LOCALE 1 2021-03-22 "Linux man-pages (unreleased)" "Linux User Manual"
7 locale \- get locale-specific information
10 .BR locale " [\fIoption\fP]"
11 .BR locale " [\fIoption\fP] " \-a
12 .BR locale " [\fIoption\fP] " \-m
13 .BR locale " [\fIoption\fP] \fIname\fP..."
18 command displays information about the current locale, or all locales,
21 When invoked without arguments,
23 displays the current locale settings for each locale category (see
25 based on the settings of the environment variables that control the locale
28 Values for variables set in the environment are printed without double
29 quotes, implied values are printed with double quotes.
35 option (or one of their long-format equivalents) is specified,
36 the behavior is as follows:
38 .BR \-a ", " \-\-all\-locales
39 Display a list of all available locales.
44 metadata about each locale to be included in the output.
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.
53 command can also be provided with one or more arguments,
54 which are the names of locale keywords (for example,
56 .IR ctype\-class\-names ,
60 or locale categories (for example,
64 For each argument, the following is displayed:
66 For a locale keyword, the value of that keyword to be displayed.
68 For a locale category,
69 the values of all keywords in that category are displayed.
71 When arguments are supplied, the following options are meaningful:
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.
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.
82 This option improves readability when multiple name arguments are specified.
83 It can be combined with the
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:
94 .IR keyword =\(dq value \(dq
100 command also knows about the following options:
102 .BR \-v ", " \-\-verbose
103 Display additional information for some command-line option and argument
106 .BR \-? ", " \-\-help
107 Display a summary of command-line options and arguments and exit.
110 Display a short usage message and exit.
112 .BR \-V ", " \-\-version
113 Display the program version and exit.
116 .I /usr/lib/locale/locale\-archive
117 Usual default locale archive location.
119 .I /usr/share/i18n/locales
120 Usual default path for locale definition files.
122 POSIX.1-2001, POSIX.1-2008.
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"
141 $ \fBlocale date_fmt\fP
142 %a %b %e %H:%M:%S %Z %Y
144 $ \fBlocale \-k date_fmt\fP
145 date_fmt="%a %b %e %H:%M:%S %Z %Y"
147 $ \fBlocale \-ck date_fmt\fP
149 date_fmt="%a %b %e %H:%M:%S %Z %Y"
151 $ \fBlocale LC_TELEPHONE\fP
158 $ \fBlocale \-k LC_TELEPHONE\fP
159 tel_int_fmt="+%c (%a) %l"
160 tel_dom_fmt="(%a) %l"
163 telephone\-codeset="UTF\-8"
166 The following example compiles a custom locale from the
172 directory, then tests the result with the
174 command, and then sets the environment variables
178 in the shell profile file so that the custom locale will be used in the
179 subsequent user sessions:
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