locale(1)
NAME
locale − get locale-specific (NLS) information
SYNOPSIS
locale [-a|-m]
locale [-ck] name ...
DESCRIPTION
locale displays information about the current locale or about available locales.
When invoked with no arguments, locale displays the name and actual or implied value of each of the locale-related environment variables: LANG, LC_CTYPE, LC_COLLATE, LC_MONETARY, LC_NUMERIC, LC_TIME, LC_MESSAGES, and LC_ALL in the order shown, one per line. An actual value is the value the variable actually has in the user’s environment; an implied value is derived from the value of some other variable. Implied values are displayed enclosed in double quotes; actual values are unquoted.
The determination of implied values is that if the variable LC_ALL is present and has a non-null value, that is the actual value for LC_ALL, and all the other variables take its value as an implied value. If LC_ALL is not set, all the LC_* variables that are set are shown with their value as an actual value. Any that have no value are shown with the value of the LANG environment variable as their implied value. LC_ALL is displayed as LC_ALL=\n if it has no value.
locale can take multiple arguments which can be locale category names, locale keywords, or the special word charmap (see localedef(1M) for a description of locale keywords and charmaps). If an argument is a keyword, the value associated with that keyword in the current environment is displayed and possibly other information, depending on selected options. If an argument is a category name (i.e., LC_*), the values of all keywords defined in that category are displayed. If an argument is the special word charmap , the charmap file (if any) that was used in the definition of the current locale is displayed.
Non-printable characters are printed as hexadecimal values in the form,
"\xhh"
except that, if a different escape character has been defined for the locale, it is displayed instead of the ’\’.
Options
The following options are available:
-a List all available locales. These are the possible meaningful values that can be assigned to LANG or any of the LC_* variables on the system, and are dependent on what locales have been installed on the system. This option excludes all others.
-c Display names of locale categories that have been selected either explicitly or by giving a keyword contained therein. This option can be used with the -k option.
-k Display names of keywords that have been selected either explicitly or by their containing category having been given as an argument. Keyword names and values are displayed as:
"<keyword>=<value>"
Without the -k option, only the values are displayed. This option can be used with the -c option.
-m Display a list of available charmap files on the system. See localedef(1M) for a definition of charmap files and how they are used.
EXTERNAL INFLUENCES
Environment Variables
LANG Determines the locale to use for the locale categories when both LC_ALL and the corresponding category do not have values specified.
LC_ALL Overrides the values of LANG and all the LC_* variables in determining the locale.
LC_CTYPE Determines the locale for interpretation of sequences of bytes as characters (e.g., single- versus multi-byte characters in arguments).
International Code Set Support
Single- and multi-byte character code sets are supported.
RETURN VALUE
locale exits with one of the following values:
0 All requested information was found and displayed successfully.
>0 An error occurred either in finding the information or in displaying it.
EXAMPLES
If the locale environment variables are set as:
LANG=abc
LC_COLLATE=xyz
The command:
locale
gives the following output:
LANG=abc
LC_CTYPE="abc"
LC_COLLATE=xyz
LC_MONETARY="abc"
LC_NUMERIC="abc"
LC_TIME="abc"
LC_MESSAGES="abc"
LC_ALL=locale -ck decimal_point
The command:
LC_ALL=POSIX locale -ck decimal_point
produces:
LC_NUMERIC decimal_point="."
If LANG is set to POSIX and no other locale variables are set, the command:
locale LC_NUMERIC
would produce:
"."
","
0;3
""
which correspond to the keywords decimal_point, thousands_sep, grouping and alt_digit.
SEE ALSO
nlsinfo(1), localedef(1m), nl_langinfo(3c), localeconv(3c)
STANDARDS CONFORMANCE
locale: POSIX.2
Hewlett-Packard Company — HP-UX Release 9.03: April 1994