[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 3

locale Command

Purpose

Writes information to standard output about either the current locale or all public locales.

Syntax

locale [ -O 64 ][ -a | -m ] | [ [ -c ] [ -k ] Name ... ]

Description

The locale command writes information to standard output about either the current locale or all public locales. A public locale is a locale available to any application.

To write the name and value of each current locale category, do not specify any flags or variables. To write the names of all available public locales, specify the -a flag. To write a list of the names of all available character-mapping (charmap) files, specify the -m flag. These charmap filenames are suitable values for the -f flag specified with the localedef command.

To write information about specified locale categories and keywords in the current locale, specify the Name parameter. The Name parameter can be one of the following:

You can specify more than one Name parameter with the locale command.

If you specify the locale command with a locale category name and no flags, the locale command writes the values of all keywords in the locale category specified by the Name parameter. If you specify the locale command with a locale keyword and no flags, the locale command writes the value of the keyword specified by the Name parameter.

If the Name parameter is a locale category name or keyword, the -c and -k flags can determine the information displayed by the locale command.

Flags

-a Writes the names of all available public locales.
-c Writes the names of selected locale categories. If the Name parameter is a keyword, the locale command writes the name of the locale category that contains the specified keyword, and the value of the specified keyword. If the Name parameter is a locale category, the locale command writes the name of the specified locale category and the values of all keywords in the specified locale category.
-k Writes the names and values of selected keywords. If the Name parameter is a keyword, the locale command writes the name and value of the specified keyword. If the Name parameter is a locale category, the locale command writes the names and values of all keywords in the specified locale category.
-m Writes the names of all available character-mapping (charmap) files.
-ck Writes the name of the locale category, followed by the names and values of selected keywords. If the Name parameter is a keyword, the locale command writes the name of the locale category that contains the specified keyword, and the name and value of the specified keyword. If the Name parameter is a locale category, the locale command writes the name of the specified locale category and the names and values of all keywords in the specified locale category.
-O 64 Displays locale information as seen by a 64 bit executable. This should be identical to information as seen by a 32 bit executable.

Exit Status

This command returns the following exit values:

0 All the requested information was found and output successfully.
>0 An error occurred.

Examples

  1. To retrieve the names and values of all the current locale environment variables, enter:

    locale

    If locale_x and locale_y are valid locales on the system, as determined with locale -a, and if the locale environment variables are set as follows:

    LANG=locale_x
    LC_COLLATE=locale_y

    The locale command produces the following output:

    LANG=locale_x
    LC_CTYPE="locale_x"
    LC_COLLATE=locale_y
    LC_TIME="locale_x"
    LC_NUMERIC="locale_x"
    LC_MONETARY="locale_x"
    LC_MESSAGES="locale_x"
    LC_ALL=

    Note: When setting the locale variables, some values imply values for other locale variables. For example, if the LC_ALL locale variable is set to the En_US locale, all locale environment variables are set to the En_US locale. In addition, implicit values are enclosed in double quotes ("). Explicitly set values are not enclosed in double quotes ("). See "Understanding Locale Environment Variables" in AIX 5L Version 5.2 National Language Support Guide and Reference for more information.
  2. To determine the current character mapping, enter:

    locale charmap

    If the LC_ALL locale variable is set to the C locale, the locale command produces the following output:

    ISO8859-1
  3. To retrieve the value of the decimal_point delimiter for the current locale, enter:

    locale  -ck  decimal_point

    If the LC_ALL locale variable is set to the C locale, the locale command produces the following output:

    LC_NUMERIC
    decimal_point="."

Related Information

The localedef command.

Character Set Description (charmap) Source File Format and Locale Definition Source File Format in AIX 5L Version 5.2 Files Reference.

For specific information about the locale definition source file format, categories, and their locale variables, see the LC_COLLATE category, LC_CTYPE category, LC_MESSAGES category, LC_MONETARY category, LC_NUMERIC category, and LC_TIME category in AIX 5L Version 5.2 Files Reference.

National Language Support Overview, and Understanding Locale Environment Variables in AIX 5L Version 5.2 National Language Support Guide and Reference.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]