Linux "localedef" Command Line Options and Examples
compile locale definition files

The localedef program reads the indicated charmap and input files, compiles them to a binary form quickly usable by the locale func‐ tions in the C library (setlocale(3), localeconv(3), etc.), and places the output in outputpath.


Usage:

localedef [options] outputpath
localedef --list-archive [options]
localedef --delete-from-archive [options] localename ...
localedef --add-to-archive [options] compiledpath
localedef --version
localedef --help
localedef --usage






Command Line Options:

--delete-from-archive
Delete the named locales from the locale archive file.
localedef --delete-from-archive ...
--list-archive
List the locales contained in the locale archive file.
localedef --list-archive ...
--add-to-archive
Add the compiledpath directories to the locale archive file. The directories should have been created by previous runs of lo‐caledef, using --no-archive.Other optionsSome of the following options are sensible only for certain operations; generally, it should be self-evident which ones.
localedef --add-to-archive ...
-f
Specify the file that defines the character set that is used by the input file. If charmapfile contains a slash character('/'), it is interpreted as the name of the character map. Otherwise, the file is sought in the current directory and the de‐fault directory for character maps. If the environment variable I18NPATH is set, $I18NPATH/charmaps/ and $I18NPATH/ are alsosearched after the current directory. The default directory for character maps is printed by localedef --help.
localedef -f ...
-i
Specify the locale definition file to compile. The file is sought in the current directory and the default directory for lo‐cale definition files. If the environment variable I18NPATH is set, $I18NPATH/locales/ and $I18NPATH are also searched afterthe current directory. The default directory for locale definition files is printed by localedef --help.
localedef -i ...
-u
Read mappings from symbolic names to Unicode code points from repertoirefile. If repertoirefile contains a slash character('/'), it is interpreted as the pathname of the repertoire map. Otherwise, the file is sought in the current directory andthe default directory for repertoire maps. If the environment variable I18NPATH is set, $I18NPATH/repertoiremaps/ and$I18NPATH are also searched after the current directory. The default directory for repertoire maps is printed by localedef
localedef -u ...
-A
Use aliasfile to look up aliases for locale names. There is no default aliases file.
localedef -A ...
--prefix
Set the prefix to be prepended to the full archive pathname. By default, the prefix is empty. Setting the prefix to foo, thearchive would be placed in foo/usr/lib/locale/locale-archive.
localedef --prefix ...
-c
Write the output files even if warnings were generated about the input file.
localedef -c ...
-v
Generate extra warnings about errors that are normally ignored.
localedef -v ...
--quiet
Suppress all notifications and warnings, and report only fatal errors.
localedef --quiet ...
--posix
Conform strictly to POSIX. Implies --verbose. This option currently has no other effect. POSIX conformance is assumed ifthe environment variable POSIXLY_CORRECT is set.
localedef --posix ...
--replace
Replace a locale in the locale archive file. Without this option, if the locale is in the archive file already, an error oc‐curs.
localedef --replace ...
--no-archive
Do not use the locale archive file, instead create outputpath as a subdirectory in the same directory as the locale archivefile, and create separate output files for locale categories in it. This is helpful to prevent system locale archive updatesfrom overwriting custom locales created with localedef.
localedef --no-archive ...
-?
Print a usage summary and exit. Also prints the default paths used by localedef.
localedef -? ...
--usage
Print a short usage summary and exit.
localedef --usage ...
-V
Print the version number, license, and disclaimer of warranty for localedef.EXIT STATUSOne of the following exit values can be returned by localedef:0 Command completed successfully.1 Warnings or errors occurred, output files were written.4 Errors encountered, no output created.ENVIRONMENTPOSIXLY_CORRECTThe --posix flag is assumed if this environment variable is set.I18NPATHA colon-separated list of search directories for files.FILES/usr/share/i18n/charmapsUsual default character map path./usr/share/i18n/localesUsual default path for locale definition files./usr/share/i18n/repertoiremapsUsual default repertoire map path./usr/lib/locale/locale-archiveUsual default locale archive location./usr/lib/localeUsual default path for compiled individual locale data files.outputpath/LC_ADDRESSAn output file that contains information about formatting of addresses and geography-related items.outputpath/LC_COLLATEAn output file that contains information about the rules for comparing strings.outputpath/LC_CTYPEAn output file that contains information about character classes.outputpath/LC_IDENTIFICATIONAn output file that contains metadata about the locale.outputpath/LC_MEASUREMENTAn output file that contains information about locale measurements (metric versus US customary).outputpath/LC_MESSAGES/SYS_LC_MESSAGESAn output file that contains information about the language messages should be printed in, and what an affirmative or negativeanswer looks like.outputpath/LC_MONETARYAn output file that contains information about formatting of monetary values.outputpath/LC_NAMEAn output file that contains information about salutations for persons.outputpath/LC_NUMERICAn output file that contains information about formatting of nonmonetary numeric values.outputpath/LC_PAPERAn output file that contains information about settings related to standard paper size.outputpath/LC_TELEPHONEAn output file that contains information about formats to be used with telephone services.outputpath/LC_TIMEAn output file that contains information about formatting of data and time values.CONFORMING TOPOSIX.1-2008.EXAMPLECompile the locale files for Finnish in the UTF-8 character set and add it to the default locale archive with the name fi_FI.UTF-8:localedef -f UTF-8 -i fi_FI fi_FI.UTF-8The next example does the same thing, but generates files into the fi_FI.UTF-8 directory which can then be used by programs when theenvironment variable LOCPATH is set to the current directory (note that the last argument must contain a slash):localedef -f UTF-8 -i fi_FI ./fi_FI.UTF-8
localedef -V ...