Wednesday, May 1, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 585  / 1 Year ago, thu, april 20, 2023, 11:42:41

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.


More From » python

 Answers
1

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()

[#33823] Saturday, April 22, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ngthmated

Total Points: 12
Total Questions: 115
Total Answers: 113

Location: Saint Vincent and the Grenadines
Member since Wed, Apr 21, 2021
3 Years ago
;