How to prevent DNF from installing all locales

Looking for some advise.
I have a Fedora installation and I am trying to reduce it’s footprint. I have noticed that the /usr/share/locale and /usr/share/man folders are full of language packs that I will never use and consume about 800MB.
I can use something like BleachBit to remove these however with every update that I do with DNF they will slowly be replaced.
Is there a way to instruct DNF to only install certain locales?
I have searched the net but either my google-fu is bad or the functionality does not exist.
Thanks in Advance

Welcome to :fedora: watch fedora is extremely minimal distro and does not contain unnecessary packages now coming to the point if you remove them it may cause some issues like some stuff will be not right there are some fronts will some error when seeing stuff.

HI Martin thanks for the recommendation - This is an HTPC server that I have been running since Fedora 6 days (now on FC35). As such it has a lot happening and configured on it and I am not really keen to deploy an entire new distro. Rather I am just keen to see if I can reduce non necessary installations. I will never look at a japanese man page nor ever use the german locale so I see no point in having them installed and using up the small (64GB) SSD space.

Did you try this?

Hey ilikelinux - yes that would work but it is doing pretty much exactly what BleachBlit does (find and remove the files). However if I do a dnf update and any packages are updated the package manager will just add the new locale files and man pages for that package. I was hoping that there is a way to tell DNF that I am only interested in a certain language and for it to not install the language packs in the package for other languages.
I see there used to be a plugin for DNF called langpacks but since I cannot install that I assume it has been deprecated.
Of course I am assuming that the package manager has a way to tie locale metadata into the file list - if it does not (and package maintainers do not flag the languages) then it probably does not work.
I guess I could write a script to go through those directories and remove any non english directories and just run said script on a cron job, I am just looking for a better way of handling this.

Those packages include those locale files because they are packaged like that. Some packages are splitted into subpackages and you can manage installing language packs like you described, for example glibc. But if it is packaged to contain all language files in a single package, e.g. dnf itself is packaged like that, you can’t tell it to exclude certain files as fas as I know.

That’s pretty much what I was asking. Does DNF have such a concept of identifying locale metadata in packages and ignoring unwanted locales. So it seems such a feature does not exist. Fair enough.

It has ability to identify documentation which is specified by %doc RPM macro and there is --nodocs DNF option to opt out of installing them. I am not aware of such a mechanism for language files.

Probably something that could be useful feature - I mean if the locale files are coming in at 1Gb then it is a decent saving.

1 Like

Take a look at the %_install_langs macro. You can put it in a file in /etc. You can see an example if you start a fedora container image; they just install en_US.

Aaah thanks let me look into that - interesting indeed