locale(C)


locale -- get locale-specific information

Syntax

locale [ -a | -m ]

locale [ -ck ] name ...

Description

locale either displays information about the current locale environment or displays information about all locales. A locale defines your environment in terms of language and cultural conventions. It consists of one or more categories corresponding to these environment variable names:

LC_ALL
If set and exported, this variable specifies the setting of all locale categories.

LC_COLLATE
Collation order used by commands such as sort(C) and uniq(C).

LC_CTYPE
Character classification and case conversion.

LC_MESSAGES
Formats of informative and diagnostic messages and interactive responses.

LC_MONETARY
Monetary formatting.

LC_NUMERIC
Numeric, non-monetary formatting.

LC_TIME
Date and time formats.

LANG
The default locale of the current environment. Aspects of this locale may be overridden by the individual settings of the LC_* variables.
When locale is invoked without arguments, it lists the values of all of the variables.

locale takes the following options:


-a
Display information about all public locales.

-m
Display the names of available charmaps.

-c
Display the names of selected categories.

-k
Display the names and values of selected keywords.
name is the name of a locale category or of a keyword within a locale category. If name is the reserved word charmap, locale prints the name of the charmap (if any) that was specified when the locale was created (using localedef -f).

Exit values

locale returns 0 on success and a value greater than 0 if an error occurred.

Examples

If locale is invoked without any options, it displays the names and values of LANG and the locale category variables. The value of LC_ALL overrides all internationalization variables including LANG. The values of the locale category variables (LC_*) are displayed as set in the environment unless they are overridden by the setting of the LC_ALL variable. If LANG is set to ``en_GB.ISO8859-1'' and LC_ALL is not set, locale with no options will produce the following output:
   LANG=en_GB.ISO8859-1
   LC_CTYPE="en_GB.ISO8859-1"
   LC_COLLATE="en_GB.ISO8859-1"
   LC_TIME="en_GB.ISO8859-1"
   LC_NUMERIC="en_GB.ISO8859-1"
   LC_MONETARY="en_GB.ISO8859-1"
   LC_MESSAGES="en_GB.ISO8859-1"
   LC_ALL=
If LC_ALL is set to another value, this overrides all the category variables (LC_*); LANG is not altered. An individual category can also be assigned a separate value.

locale -c LC_NUMERIC produces output such as:

   LC_NUMERIC
   en_GB.ISO8859-1
   LC_NUMERIC
   .
   LC_NUMERIC
   ,
   LC_NUMERIC
locale -ck LC_NUMERIC additionally lists keywords within the selected category:
   LC_NUMERIC
   LC_NUMERIC="en_GB.ISO8859-1"
   LC_NUMERIC
   decimal_point="."
   LC_NUMERIC
   thousands_sep=","
   LC_NUMERIC
   grouping=""
If you want to view the value of a specific keyword, specify its name. For example, locale -ck decimal_point might produce the output:
   LC_NUMERIC
   decimal_point="."
Simply entering locale -k decimal_point results in the output:
   decimal_point="."

See also

environ(M), locale(M), localedef(C)

Standards conformance

locale is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005