Gentoo: Specifying only needed locales

Reading time: 2 – 3 minutes

[Gentoo Weekly News] The locales a user can choose from are built by the glibc. Usually all
available locales starting from aa_DJ (Afar locale for Djibouti) over
en_US (English locale for the USA) to zu_ZA.utf8 (Zulu locale for South
Africa) will be installed. Unless you’re working at the UN and administer
a central server for all member states, it is difficult to conceive why
you would need a system where all of these locales are installed. This
week’s tip was written with all those of you in mind who’d like to save 90
percent of the space occupied by locales in their system, by limiting the
number of installed locales to the bare minimum.

Ever since sys-libs/glibc- has been in Portage, a
USE-flag called userlocales was provided to make sure only those locales
mentioned in /etc/ are to be built and installed. As a
side-effect, this also leads to a much faster emerge of glibc, obviously.

Activate the userlocales USE flag especially for |

echo "sys-libs/glibc userlocales" >> /etc/portage/package.use

Now specify the locales you want to be able to use: (/etc/

The format of the locales is described in the file itself.               

For further information about locale-handling make sure you read our
Gentoo Linux Localization Guide.

Another interesting tool is app-admin/localepurge which can clean out any
installed man-page or info-file in languages you don’t need on your
system. You should read the man-page to localepurge in any case, and
configure languages you intend to keep in /etc/locale.nopurge.

By the way, if you want to prohibit the installation of all man-pages,
info-files or documentation, for example when space on your disk is
severely limited, you can add noman, nodoc and/or noinfo to FEATURES in
your /etc/make.conf.