-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathgenerate_desktop_files
executable file
·43 lines (35 loc) · 1.61 KB
/
generate_desktop_files
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/python3
DOMAIN = "mintdesktop"
PATH = "/usr/share/linuxmint/locale"
import os
import gettext
import subprocess
from mintcommon import additionalfiles
os.environ['LANGUAGE'] = "en_US.UTF-8"
gettext.install(DOMAIN, PATH)
prefix = "[Desktop Entry]\n"
suffix = """Exec=mintdesktop
Icon=user-desktop
Terminal=false
Type=Application
Encoding=UTF-8
Categories=GNOME;GTK;Settings;DesktopSettings;XFCE;X-XFCE-SettingsDialog;X-XFCE-PersonalSettings;
StartupNotify=false
OnlyShowIn=MATE;XFCE;
"""
additionalfiles.generate(DOMAIN, PATH, "usr/share/applications/mintdesktop.desktop", prefix, _("Desktop Settings"), _("Fine-tune desktop settings"), suffix)
locales = []
cur_dir = os.getcwd()
os.chdir("/usr/share/linuxmint/locale")
lines = subprocess.getoutput("find */LC_MESSAGES/mintdesktop.mo")
for line in lines.split("\n"):
line = line.strip().split("/")[0]
locales.append(line)
os.chdir(cur_dir)
for locale in locales:
os.system("mkdir -p usr/share/help/%s/mintdesktop/" % locale)
os.system("msgunfmt /usr/share/linuxmint/locale/%s/LC_MESSAGES/mintdesktop.mo > /tmp/%s.po" % (locale, locale))
os.system("xml2po -p /tmp/%s.po -o usr/share/help/%s/mintdesktop/index.page usr/share/help/C/mintdesktop/index.page" % (locale, locale))
os.system("xml2po -p /tmp/%s.po -o usr/share/help/%s/mintdesktop/wms.page usr/share/help/C/mintdesktop/wms.page" % (locale, locale))
os.system("xml2po -p /tmp/%s.po -o usr/share/help/%s/mintdesktop/compositing.page usr/share/help/C/mintdesktop/compositing.page" % (locale, locale))
os.system("cp usr/share/help/C/mintdesktop/legal.xml usr/share/help/%s/mintdesktop/" % locale)