localedef - Builds a locale from locale and character map source files
localedef [-C compiler_options] [-c] [-f character_map] [-i sourcefile] [-L linker_options] [-m methodfile] [-P tool_path] [-v] [-w] localename
Interfaces documented on this reference page conform to industry standards as follows:
Refer to the
reference page for more information
about industry standards and associated tags.
[Compaq] Passes the specified options to the compiler that
builds the locale. If you are specifying more than one option, enclose the
list in double quotes.
Forces the creation of locale tables. This option
be used if you have received warning messages; otherwise,
the locale tables will not be created.
Specifies a file that maps character and collating symbols
to actual character encodings. Using the
one source definition to be applicable to more than one codeset. If this option
is not specified, the Portable Character Set (PCS) is used. The
option must be used if symbolic names (other than collating symbols
defined in a
keyword) are used. For more
information about a character map file, see the
Specifies the pathname of a file containing the locale category
source definitions. If this option is not present, source definitions are
read from standard input. For more information about
sourcefile, see the
[Compaq] Passes the specified link options to the
command used to build the locale.
[Compaq] Specifies the name of a method file that describes
which methods are to be overridden when constructing a locale. The
command reads the method file and uses the entry points
when constructing the locale objects. The codeset methods specified are also
used in parsing the
[Compaq] Prepends the specified path to the compiler and
[Compaq] Runs the command in verbose mode to display information
used for debugging.
[Compaq] Displays warnings when duplicate definitions are
Identifies the locale and determines where it will be built.
The localedef command converts source files that contain definitions of the locale-dependent information (collation, date-and-time displays, and character properties) into a run-time format. The command then assigns the definitions a locale name to be used with commands and functions that set the locale.
If a locale category source definition contains a copy statement and the statement names a valid existing locale that is installed in the system, localedef behaves as if the source definition had contained a valid category source definition for the named locale.
[Compaq] The localedef command can also process a file that specifies how to build a methods library to be used by character- and string-conversion functions when they operate in the locale environment. This library is necessary for locales based on multibyte codesets, which require conversion methods that are different from the default methods used by C library routines. A method file has the following format:
METHODS method entry[package[library_path]] END METHODS
[Compaq] The method file contains the following information: The name of the method. The C function that implements the method. This function is tailored to the locale's codeset. The optional package name for the shared library. The package field is ignored; however, you must specify it if you specify library_path. The pathname of the shared-library or loadable object that contains the entry implementations.
[Compaq] The package and library_path fields are optional. If not specified, these fields default to libc and /usr/shlib/libc.so, respectively. The localedef command retains the last value specified for both of these fields, so you need to specify these values only once to override the default for the entire methods file.
[Compaq] The following example of a methods file lists all of the valid values for the method field in the first column, along with the default entry, package, and pathname values that are used with single-byte locales other than the POSIX locale:
__mbstopcs "__mbstopcs_sb" "libc" "/usr/shlib/libc.so" __mbtopc "__mbtopc_sb" __pcstombs "__pcstombs_sb" __pctomb "__pctomb_sb" mblen "__mblen_sb" mbstowcs "__mbstowcs_sb" mbtowc "__mbtowc_sb" wctomb "__wctomb_sb" wcstombs "__wcstombs_sb" wcwidth "__wcwidth_latin" wcswidth "__wcswidth_latin"
fnmatch "__fnmatch_std" iswctype "__iswctype_std" localeconv "__localeconv_std" nl_langinfo "__nl_langinfo_std" regcomp "__regcomp_std" regexec "__regexec_std" regfree "__regfree_std" rpmatch "__rpmatch_std" regerror "__regerror_std" towupper "__towupper_std" towlower "__towlower_std" strcoll "__strcoll_std" strfmon "__strfmon_std" strftime "__strftime_std" strptime "__strptime_std" strxfrm "__strxfrm_std" wcscoll "__wcscoll_std" wcsftime "__wcsftime_std" wcsxfrm "__wcsxfrm_std" wctype "__wctype_std"
[Compaq] If you supply a methods file for your locale, the file must contain entries for the following methods because, without them, it is not possible to read the charmap file:
__mbstopcs __mbtopc __pcstombs __pctomb mblen mbstowcs mbtowc wcstombs wcswidth wctomb wcwidth
[Compaq] Entries for methods other than the preceding ones are optional.
The localedef command returns the following exit values: No errors occurred and the locale was successfully created. Warnings occurred and the locale was successfully created. The locale specification exceeded limits or the coded character set or sets being used are not supported, and no locale was created. The capability to create new locales is not supported. Warnings or errors occurred and no output was created.
If an error occurs on execution of the localedef command, it does not create an output file.
If warnings occur, the command creates an output file only if the
option is specified. The following conditions cause warning messages
to be issued:
A symbolic name not found in the charmap file was used for
the descriptions of the
categories. (For other categories, this condition is treated as
The number of operands to the order keyword exceeds the
Optional but unsupported keywords are present in the source
To review localedef diagnostic messages, enter the following commands: % cd /usr/lib/nls/msg/en_US.ISO8859-1 % dspcat localedef.cat | more
To create a locale called Austin from standard input and to disregard warnings, enter the following: localedef -c Austin To create a locale called Austin from Austin.src as source input, enter the following: localedef -i Austin.src Austin
The following environment variables (see
affect execution of the
Provides a default value for the locale category variables
that are not set.
If set to a nonempty string value, overrides the values of
all locale category variables and
Specifies the locale used to interpret byte sequences as characters
in, for example, command parameters. Note that the setting of this variable
does not affect the processing of the input source, for which the command
always uses the POSIX locale.
Specifies the locale that determines which translations to
use, if any exist, for the command's messages.
Determines the search path that the command uses to find message
catalogs needed for processing
Files: charmap(4), locale(4)
Others: i18n_intro(5), iconv_intro(5), l10n_intro(5), standards(5)
Writing Software for the International Market