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
Refer to the standards(5) reference page for more information about indus-
try standards and associated tags.
[Tru64 UNIX] 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.
-c Forces the creation of locale tables. This option must be used if you
have received warning messages; otherwise, the locale tables will not
Specifies a file that maps character and collating symbols to actual
character encodings. Using the -f option allows one source definition
to be applicable to more than one codeset. If this option is not speci-
fied, the Portable Character Set (PCS) is used. The -f option must be
used if symbolic names (other than collating symbols defined in a
collating-symbol keyword) are used. For more information about a char-
acter map file, see the charmap(4) reference page.
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 locale(4) reference page.
[Tru64 UNIX] Passes the specified link options to the ld command used
to build the locale.
[Tru64 UNIX] Specifies the name of a method file that describes which
methods are to be overridden when constructing a locale. The localedef
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 charmap file.
[Tru64 UNIX] Prepends the specified path to the compiler and linker
-v [Tru64 UNIX] Runs the command in verbose mode to display information
used for debugging.
-w [Tru64 UNIX] Displays warnings when duplicate definitions are encoun-
Identifies the locale and determines where it will be built.
[Tru64 UNIX] On this operating system, locales can be moved after they
are created, and the presence or absence of slash (/) characters in
localename does not indicate whether a locale is later treated as pub-
lic or private. The default directory for public locales is
/usr/lib/nls/loc to which, assuming the appropriate privileges, a
locale can be moved after it is created.
When running the localedef command on other operating systems, you may
have to omit slash (/) characters from localename when creating a pub-
lic locale and include them only when creating a private locale. On
these platforms, public locales are automatically created in the
appropriate directory and may be the only locales that system commands
The localedef command converts source files that contain definitions of the
locale-dependent information (collation, date-and-time displays, and char-
acter properties) into a run-time format. The command then assigns the
definitions a locale name to be used with commands and functions that set
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.
[Tru64 UNIX] 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:
[Tru64 UNIX] 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
[Tru64 UNIX] The package and library_path fields are optional. If not
specified, these fields default to libc and /usr/shlib/libc.so, respec-
tively. 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.
[Tru64 UNIX] 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"
[Tru64 UNIX] 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:
[Tru64 UNIX] Entries for methods other than the preceding ones are
The localedef command returns the following exit values:
0 No errors occurred and the locale was successfully created.
1 Warnings occurred and the locale was successfully created.
2 The locale specification exceeded limits or the coded character set or
sets being used are not supported, and no locale was created.
3 The capability to create new locales is not supported.
>>3 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 -c option
is specified. The following conditions cause warning messages to be
+ A symbolic name not found in the charmap file was used for the
descriptions of the LC_TYPE or LC_COLLATE categories. (For other
categories, this condition is treated as an error.)
+ The number of operands to the order keyword exceeds the
+ Optional but unsupported keywords are present in the source input.
[Tru64 UNIX] To review localedef diagnostic messages, enter the following
% cd /usr/lib/nls/msg/en_US.ISO8859-1
% dspcat localedef.cat | more
1. To create a locale called Austin from standard input and to disregard
warnings, enter the following:
localedef -c Austin
2. 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 i18n_intro(5) and l10n_intro(5))
affect execution of the localedef command:
Provides a default value for the locale category variables that are not
If set to a nonempty string value, overrides the values of all locale
category variables and LANG.
Specifies the locale used to interpret byte sequences as characters in,
for example, command parameters. Note that the setting of this vari-
able 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 cata-
logs needed for processing LC_MESSAGES.
Files: charmap(4), locale(4)
Others: i18n_intro(5), iconv_intro(5), l10n_intro(5), standards(5)
Writing Software for the International Market