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-archive option is used, outputpath is the name of a subdirectory in /usr/lib/locale where 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 variable LOCPATH isn'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 of localedef using --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 ๐Ÿ’€

  • -f charmapfile, --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 variable I18NPATH is set, $I18NPATH/charmaps/ and $I18NPATH/ are also searched after the current directory. The default directory for character maps is printed by localedef --help. ๐Ÿ—บ๏ธ
  • -i inputfile, --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 variable I18NPATH is set, $I18NPATH/locales/ and $I18NPATH are also searched after the current directory. The default directory for locale definition files is printed by localedef --help. ๐Ÿ“‚
  • -u repertoirefile, --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 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 --help. ๐Ÿ”ค
  • -A aliasfile, --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 with localedef. 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 are ascii and intcurrsym.
  • --posix โ€” Conform strictly to POSIX. Implies --verbose. This option currently has no other effect. POSIX conformance is assumed if the environment variable POSIXLY_CORRECT is 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 to foo, the archive would be placed in foo/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 --replace is the "make room, i'm coming through" option ๐Ÿšช)
  • --warnings=warnings โ€” Comma-separated list of warnings to enable. Supported warnings are ascii and intcurrsym.
  • --help, -? โ€” Print a usage summary and exit. Also prints the default paths used by localedef. she's helpful like that ๐Ÿซถ
  • --usage โ€” Print a short usage summary and exit.
  • --version, -V โ€” Print the version number, license, and disclaimer of warranty for localedef.

๐ŸŒˆ 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 --posix flag 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
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms