localedef Command

Purpose

Converts locale and character set description (charmap) source files to produce a locale database.

Syntax

localedef [ -c ] [ -f Charmap ] [ -i SourceFile ] [ -L LinkOptions ] [ -m MethodFile ] LocaleName

Description

The localedef command converts source files that contain definitions of locale-dependent information (such as collation, date and time formats, and character properties) into a locale object file used at run-time. The locale object file created by the localedef command is then used by commands and subroutines that set the locale with the setlocale subroutine.

The -i SourceFile flag and variable specify the file that contains the source category definitions. If the -i flag is not specified, the file is read from standard input.

The -f CharMap flag and variable specify a file that maps character symbols to actual character encodings. Using the -f flag allows one locale source definition to be applicable to more than one code set. If the -f flag is not specified, the default value for the CharMap variable is ISO8859-1.

The LocaleName parameter specifies the locale name for the locale database generated by the localedef command from the specified source files. The LocaleName parameter can be either an absolute path name for the file location or a relative path name.

If a locale category source definition contains a copy statement and the statement names an existing locale installed in the system, the localedef command proceeds as though the source definition contained the valid category source definition for the named locale.

Notes:
  1. The localedef command uses the C compiler to generate the locale database. Therefore, to use this command you must have the C compiler installed.
  2. When replacing systemwide databases, it is advisable to do a soft reboot to ensure that the new locale is used throughout the system.

If an error is detected, no permanent output is created.

If warnings occur, permanent output is created when the -c flag is specified. The following conditions cause warning messages to be issued:

  • A symbolic name not found in the file pointed to by the Charmap variable is used for the descriptions of the LC_TYPE or LC_COLLATE categories. This is an error condition for other categories.
  • The number of operands to the order_start keyword exceeds the COLL_WEIGHTS_MAX limit.
  • Optional keywords not supported by the implementation are present in the source file.

Flags

Item Description
-c Forces the creation of locale tables even if warning messages have been issued.
-f CharMap Specifies the name of a file containing a mapping of character symbols and collating element symbols to actual character encodings. A locale is associated with one and only one code set. If this flag is not specified, the ISO 8859-1 code set is assumed.
Note: The use of certain system-provided CharMap files is fully supported. However, while correctly defined user-provided CharMap files may work properly, the result of such use is not guaranteed.
-i SourceFile Specifies the path name of a file containing the locale category source definitions. If this flag is not present, source definitions are read from standard input.
-L LinkOptions Passes the specified link options to the ld command used to build the locale.
-m MethodFile Specifies the name of a method file that describes the methods to override when constructing a locale. The method file specifies user-supplied subroutines that override existing definitions, as well as a path name for the library containing the specified subroutines. The localedef command reads the method file and uses entry points when constructing the locale objects. The code set methods specified are also used in parsing the file pointed to by the CharMap variable.
Note: To create a 64-bit locale, the method file must specify the path of the library as a single archive that has two shared objects, one 32-bit and the other 64-bit, that contain the specified subroutines. Specifying separate paths to the 32-bit and 64-bit shared objects causes the localedef command to fail due to incompatible XCOFF format.
LocaleName Specifies the name of the locale to be created. This is the name that can subsequently be used to access this locale information.

Exit Status

The localedef command returns the following exit values:

Item Description
0 No errors occurred and the locales were successfully created.
1 Warnings occurred and the locales were successfully created.
2 The locale specification exceeded limits or the code set or sets used were not supported by the implementation, and no locale was created.
3 The capability to create new locales is not supported.
>3 Warnings or errors occurred and no locales were created.

Examples

  1. To create a locale called Austin from standard input and disregard warnings, enter:
    localedef  -c  Austin
  2. To create a locale called Austin with Austin.src as source input, enter:
    localedef  -i  Austin.src  Austin