localedef(1)
๐ localedef(1) โ the girlies' guide to compiling locale definition files ๐
okay so bestie, welcome to localedef, from the General Commands Manual section of the manual. she's the one who takes your locale definition files and actually makes them usable, and honestly? iconic behaviour. let's get into it ๐
โจ NAME โจ
localedef โ compile locale definition files
๐ธ SYNOPSIS ๐ธ
localedef [options] outputpath
localedef --add-to-archive [options] compiledpath
localedef --delete-from-archive [options] localename ...
localedef --list-archive [options]
localedef --help
localedef --usage
localedef --version
๐ฆ DESCRIPTION ๐ฆ
So here's the tea, bestie: the localedef program reads the charmap and input files you point it at, compiles them into a binary form that the locale functions in the C library (setlocale(3), localeconv(3), etc.) can use fast, and then drops that output into outputpath. she's basically the compiler but for locales, no cap โจ
Now, how outputpath gets interpreted is a whole situation โ here are the three moods:
- If outputpath contains a slash character (
/), it's treated as the name of the directory where the output definitions get stored. In this case there's a separate output file for each locale category (LC_TIME,LC_NUMERIC, and so on) โ very organized of her ๐ - If the
--no-archiveoption is used, outputpath is the name of a subdirectory in/usr/lib/localewhere the per-category compiled files get placed. - Otherwise, outputpath is the name of a locale, and the compiled locale data gets added to the archive file
/usr/lib/locale/locale-archive. Real talk: a locale archive is a memory-mapped file that holds all the system-provided locales, and every localized program uses it when the environment variableLOCPATHisn't set. main character file fr fr ๐ซถ
In any case, localedef aborts if the directory it's trying to write locale files into hasn't already been created. she will NOT make the folder for you. she is not your mom.
If no charmapfile is given, the value ANSI_X3.4-1968 (that's ASCII, bestie) is used by default. And if no inputfile is given, or if it's given as a dash (-), localedef reads from standard input. genderfluid queen ๐ง
๐ OPTIONS ๐
๐ Operation-selection options
A few options tell localedef to do something other than compile locale definitions. Only one of these at a time, okay? pick a lane bestie ๐
--add-to-archiveโ Adds the compiledpath directories to the locale archive file. Those directories should've been created by previous runs oflocaledefusing--no-archive. (so like, she's collecting them up ๐)--delete-from-archiveโ Deletes the named locales from the locale archive file. bye girl ๐--list-archiveโ Lists the locales contained in the locale archive file. window shopping โจ
๐ Other options
Some of these only make sense for certain operations; generally it should be self-evident which ones. And heads up: -f and -c are reversed from what you might expect โ that is, -f is not the same as --force. ikr. we don't make the rules ๐
-fcharmapfile,--charmap=charmapfile โ Specify the file that defines the character set used by the input file. If charmapfile contains a slash character (/), it's interpreted as the name of the character map. Otherwise the file is sought in the current directory and the default directory for character maps. If the environment variableI18NPATHis set,$I18NPATH/charmaps/and$I18NPATH/are also searched after the current directory. The default directory for character maps is printed bylocaledef --help. ๐บ๏ธ-iinputfile,--inputfile=inputfile โ Specify the locale definition file to compile. The file is sought in the current directory and the default directory for locale definition files. If the environment variableI18NPATHis set,$I18NPATH/locales/and$I18NPATHare also searched after the current directory. The default directory for locale definition files is printed bylocaledef --help. ๐-urepertoirefile,--repertoire-map=repertoirefile โ Read mappings from symbolic names to Unicode code points from repertoirefile. If repertoirefile contains a slash character (/), it's interpreted as the pathname of the repertoire map. Otherwise the file is sought in the current directory and the default directory for repertoire maps. If the environment variableI18NPATHis set,$I18NPATH/repertoiremaps/and$I18NPATHare also searched after the current directory. The default directory for repertoire maps is printed bylocaledef --help. ๐ค-Aaliasfile,--alias-file=aliasfile โ Use aliasfile to look up aliases for locale names. There is no default aliases file. gotta bring your own ๐--force,-cโ Write the output files even if warnings were generated about the input file. she's writing it anyway, periodt ๐--verbose,-vโ Generate extra warnings about errors that are normally ignored. she's telling you everything now, you asked for this ๐--big-endianโ Generate big-endian output.--little-endianโ Generate little-endian output.--no-archiveโ Don't use the locale archive file. Instead, create outputpath as a subdirectory in the same directory as the locale archive file, and create separate output files for locale categories in it. This is helpful to prevent system locale archive updates from overwriting custom locales created withlocaledef. protect your little guys ๐ก๏ธโจ--no-hard-linksโ Don't create hard links between installed locales.--no-warnings=warnings โ Comma-separated list of warnings to disable. Supported warnings areasciiandintcurrsym.--posixโ Conform strictly to POSIX. Implies--verbose. This option currently has no other effect. POSIX conformance is assumed if the environment variablePOSIXLY_CORRECTis set. law-abiding queen ๐--prefix=pathname โ Set the prefix to be prepended to the full archive pathname. By default, the prefix is empty. Setting the prefix tofoo, the archive would be placed infoo/usr/lib/locale/locale-archive. very "everything in its own box" of her ๐ฆ--quietโ Suppress all notifications and warnings, and report only fatal errors. shhh ๐คซ--replaceโ Replace a locale in the locale archive file. Without this option, if the locale is in the archive file already, an error occurs. (so--replaceis the "make room, i'm coming through" option ๐ช)--warnings=warnings โ Comma-separated list of warnings to enable. Supported warnings areasciiandintcurrsym.--help,-?โ Print a usage summary and exit. Also prints the default paths used bylocaledef. she's helpful like that ๐ซถ--usageโ Print a short usage summary and exit.--version,-Vโ Print the version number, license, and disclaimer of warranty forlocaledef.
๐ EXIT STATUS ๐
localedef can return one of these exit values, bestie:
0โ Command completed successfully. ate and left no crumbs โจ1โ Warnings or errors occurred, output files were written. messy but it happened ๐4โ Errors encountered, no output created. she said no ๐
๐ ENVIRONMENT ๐
POSIXLY_CORRECTโ The--posixflag is assumed if this environment variable is set.I18NPATHโ A colon-separated list of search directories for files. (the ": " is doing a lot of work here ๐ง)
๐ FILES ๐
/usr/share/i18n/charmapsโ Usual default character map path./usr/share/i18n/localesโ Usual default path for locale definition files./usr/share/i18n/repertoiremapsโ Usual default repertoire map path./usr/lib/locale/locale-archiveโ Usual default locale archive location./usr/lib/localeโ Usual default path for compiled individual locale data files.outputpath/LC_ADDRESSโ An output file that contains information about formatting of addresses and geography-related items. ๐บ๏ธoutputpath/LC_COLLATEโ An output file that contains information about the rules for comparing strings.outputpath/LC_CTYPEโ An output file that contains information about character classes.outputpath/LC_IDENTIFICATIONโ An output file that contains metadata about the locale. her little ID card ๐ชชoutputpath/LC_MEASUREMENTโ An output file that contains information about locale measurements (metric versus US customary). ๐outputpath/LC_MESSAGES/SYS_LC_MESSAGESโ An output file that contains information about the language messages should be printed in, and what an affirmative or negative answer looks like.outputpath/LC_MONETARYโ An output file that contains information about formatting of monetary values. ๐ธoutputpath/LC_NAMEโ An output file that contains information about salutations for persons.outputpath/LC_NUMERICโ An output file that contains information about formatting of nonmonetary numeric values. ๐ขoutputpath/LC_PAPERโ An output file that contains information about settings related to standard paper size. ๐outputpath/LC_TELEPHONEโ An output file that contains information about formats to be used with telephone services. โ๏ธoutputpath/LC_TIMEโ An output file that contains information about formatting of data and time values. โฐ (yes, "data and time", that's what the page says, i'm not touching it ๐ซถ)
โญ STANDARDS โญ
POSIX.1-2008. certified, validated, blessed ๐
๐ง EXAMPLES ๐ง
okay so let's compile 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-8
and the next example does the same thing, but generates files into the fi_FI.UTF-8 directory โ which can then be used by programs when the environment variable LOCPATH is set to the current directory. (note: the last argument must contain a slash, bestie, don't forget ๐ซถ)
localedef -f UTF-8 -i fi_FI ./fi_FI.UTF-8
๐ SEE ALSO ๐
locale(1), charmap(5), locale(5), repertoiremap(5), locale(7)
and that's the whole page, bestie!! no notes, she ate ๐
โจ this was Linux man-pages version 6.20, dated 2026-02-08 โ mwah, love u, go compile something gorgeous ๐๐๐ฆ
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: GPL-2.0-or-later
- Copyright 2001, Richard Braakman
- Copyright 2004, Alastair McKinstry
- Copyright 2005, Lars Wirzenius <liw@iki.fi>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms