Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This code gives me only English application name if .desktop file does not have "Name[*]" options (like in totem.desktop) but only "X-Ubuntu-Gettext-Domain: totem":

from gi.repository import Gio
app = Gio.app_info_get_default_for_type('video/x-flv', True)
print app.get_name()

This like code gives me proper result for vlc.desktop.

Ubuntu Dash shows proper localized names for all applications.

How do I get localized names of application in python?

Sorry for my English.

share|improve this question

You'll need to get the value for X-Ubuntu-Gettext-Domain, and get the translation from that domain with something like gettext.dgettext(domain, app_name). Most app names aren't/shouldn't be translated, though.

share|improve this answer
Thanks! Should I get domain directly from .desktop files? – Mystic-Mirage Dec 7 '12 at 17:59
Yes, it appears you'll have to load the .desktop file with the GKeyFile API directly to get the domain. I don't see any any API methods to do so in the app info APIs. – dobey Dec 7 '12 at 18:07
up vote 1 down vote accepted

I found the solution. This code works perfect:

from gi.repository import Gio
from xdg.DesktopEntry import DesktopEntry

app = Gio.app_info_get_default_for_type('video/x-flv', True)
filename = app.get_filename()
de = DesktopEntry(filename)

print de.getName()
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.