I want to get the pretty localized names of APT packages, such as "LibreOffice Writer" (and not libreoffice-writer
). I'm writing a script that needs this information.
I can get the localized description of a package using a command like apt show libreoffice-writer
. However, it does not show the localized title of the package. I can only find libreoffice-writer
as a name, I can't find LibreOffice Writer
in any of the fields that apt show
prints.
I know that this localized name is stored somewhere. Ubuntu's Update Manager is retrieving this name from somewhere, as you can see in this screenshot:
I found the code in Update Manager that retrieves the title of a package. It turns out, it tries to find a corresponding
.desktop
file for a package, in order to find the localized title of the package.Here's how I proved it to myself. I edited the
libreoffice-writer.desktop
file to change its name, like this:Now, when I open the update manager, I can see that the name it uses has been modified to the name I chose ("LibreOffice Writer Foobar"):
You can find this code in
/usr/lib/python3/dist-packages/UpdateManager/Core/UpdateList.py
.