Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > L

locale(1)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

locale — get locale-specific (NLS) information

SYNOPSIS

locale [ -a [ 32 | 64 ] | -A | -m ]

locale [ -ck ] name ...

locale [ -pa32 ] [ -pa64 ]

DESCRIPTION

The locale command displays information about the current locale or about available locales.

When invoked without arguments, locale displays the name and actual or implied value of each of the locale-related environment variables in the order shown below, one per line:

LANG LC_CTYPE LC_COLLATE LC_MONETARY LC_NUMERIC LC_TIME LC_MESSAGES LC_ALL

An actual value is the value the variable actually has in the user's environment. An implied value is derived from the value of another variable. Implied values are displayed enclosed in double quotes, while 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 of the other variables take its value as an implied value. If LC_ALL is not set, all of 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. If LC_ALL is set to NULL or to an invalid string, all of the LC_* variables are set to the default "C" locale.

The value of LC_ALL has precedence over any one of the environment variables LC_* and LANG. If LC_* environment variables are not defined, LANG provides the default. See catopen(3C) for more details.

The locale command can take multiple arguments, which may 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. They are dependent upon which locales have been installed on the system. By default on a PA-RISC system, the locales in /usr/lib/nls/loc/locales are listed. By default on an Itanium(R)-based system, the locales in /usr/lib/nls/loc/hpux32/locales are listed. This option takes 32 (for ILP32, 32-bit int, long, pointer, 32-bit offset) or 64 (for LP64, 64-bit long, pointer, 64-bit offset) as its argument.

-a

Display 32-bit locales for PA-RISC and Itanium-based systems.

-a 32

Display 32-bit locales for PA-RISC and Itanium-based systems.

-a 64

Display only 64-bit locales on 64-bit systems. If executed on a 32-bit system, an error message is returned.

-A

List Itanium-based system 32-bit locales, Itanium-based system 64-bit locales, PA-RISC 32-bit locales and PA-RISC 64-bit locales available on the system.

-m

Display a list of available charmap files on the system. See localedef(1M) for a definition of charmap files and their usage.

-c

Display names of locale categories that have been selected either explicitly or by giving a keyword contained therein. This option may be used with the -k option.

-k

Display names of keywords that have been selected either explicitly or by providing their containing category 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.

-pa32

Display 32-bit PA-RISC locales. (Option available only on Itanium-based systems.)

-pa64

Display 64-bit PA-RISC locales. (Option available only on Itanium-based systems.)

name

Specify the locale category name, locale keyword, or the special word charmap.

EXTERNAL INFLUENCES

Environment Variables

LANG provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the default value of "C" (see lang(5)) is used. If any of the internationalization variables contains an invalid setting, locale will behave as if all internationalization variables are set to "C". See environ(5).

LC_ALL, when set to a non-empty string value, overrides the values of all other internationalization variables.

LC_CTYPE determines the interpretation of text as single and/or multi-byte characters, the classification of characters as printable, and the characters matched by character class expressions in regular expressions.

LC_MESSAGES determines the locale that should be used to affect the format and content of diagnostic messages written to standard error, and informative messages written to standard output.

NLSPATH determines the location of message catalog for the processing of LC_MESSAGES.

International Code Set Support

Single- and multi-byte character code sets are supported.

RETURN VALUE

The locale command exits with one of the following values:

0

All requested information was found and displayed successfully.

>0

An error occurred in either finding or displaying the information.

EXAMPLES

If the locale environment variables are set as:

LANG=fr_FR.iso88591 LC_COLLATE=C

the command:

locale

gives the following output:

LANG=fr_FR.iso88591 LC_CTYPE="fr_FR.iso88591" LC_COLLATE=C LC_MONETARY="fr_FR.iso88591" LC_NUMERIC="fr_FR.iso88591" LC_TIME="fr_FR.iso88591" LC_MESSAGES="fr_FR.iso88591" LC_ALL=

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

produces:

"." "" ""

which correspond to the keywords decimal_point, thousands_sep, grouping, and alt_digit.

STANDARDS CONFORMANCE

locale: XPG4, POSIX.2

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.