locale-gen
compiles locale definitions listed in /etc/locale.gen
TLDR
SYNOPSIS
locale-gen [--keep-existing]Ubuntu: locale-gen [options] [locale...]
DESCRIPTION
locale-gen reads /etc/locale.gen and runs localedef for every uncommented line (for example en_US.UTF-8 UTF-8), compiling the locale source files from /usr/share/i18n/locales into binary data in /usr/lib/locale/locale-archive. Custom locale sources in /usr/local/share/i18n/locales take precedence.It is a distribution-provided script rather than part of upstream glibc, so its options differ: Arch Linux's version accepts no options, Debian's accepts only --keep-existing, and Ubuntu's also accepts locale names as arguments, adding them to /etc/locale.gen before compiling. Gentoo ships a separate implementation with its own option set.After generating, set the default locale with localectl set-locale, update-locale (Debian) or /etc/locale.conf.
PARAMETERS
--keep-existing
Do not remove /usr/lib/locale/locale-archive; only compile locales that are not already available (Debian, Ubuntu).--purge
Remove existing compiled locales before generating; the default without locale arguments (Ubuntu).--no-purge
Same as --keep-existing (Ubuntu).--lang
Treat arguments as generic language codes (Ubuntu).--archive, --no-archive
Store compiled data in the single locale-archive file, or in separate directories (Ubuntu).--aliases=FILE
Read locale aliases from FILE (Ubuntu).-h, --help
Display help (Ubuntu).
CAVEATS
Requires root privileges. Without --keep-existing the whole locale archive is rebuilt, which can take a while with many locales. On Debian-based systems, dpkg-reconfigure locales edits /etc/locale.gen interactively and runs locale-gen. Generated locales are only visible to newly started programs.
SEE ALSO
locale(1), localedef(1), localectl(1), dpkg-reconfigure(8)
