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

Commands Reference, Volume 3

localedef Command


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


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


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.

  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:


-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 be overridden when constructing a locale. 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.
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:

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.


  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

Related Information

The ld command, locale command.

The setlocale subroutine.

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

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

National Language Support Overview for System Management 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 ]