Commit 0921984a authored by Elena Grandi's avatar Elena Grandi
Browse files

set-session-language improvements by Paolo Dongilli.

parent 791d340f
......@@ -10,8 +10,9 @@ from gettext import gettext as _
class App(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master.title(_("Set session locale"))
self.master.title(_("Cambia la lingua"))
self.chosen_locale = tk.StringVar(self)
self.find_current_locale()
self.find_locales()
self.pack()
self.create_widgets()
......@@ -27,18 +28,29 @@ class App(tk.Frame):
if b'utf8' in l:
self.locales.append(l.decode())
def find_current_locale(self):
cmd = "cat ~/.dmrc|grep Language|tr '=' ' '|awk '{print $2}'"
ps = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
output = ps.communicate()[0]
self.curlocale = []
for l in output.split(b'\n'):
if b'utf8' in l:
self.curlocale.append(l.decode())
def create_widgets(self):
self.text = tk.Label(
self,
text=_("Select the locale for your future sessions.")
text=_("Scegli la lingua per le prossime sessioni.")
)
self.text.pack(side="top")
self.chosen_locale.set(self.locales[0])
self.chosen_locale.set(self.curlocale[0])
self.locale_menu = tk.OptionMenu(self, self.chosen_locale, *self.locales)
self.locale_menu.pack(side="top")
self.set_button = tk.Button(self)
self.set_button['text'] = "Set locale"
self.set_button['text'] = "OK"
self.set_button['command'] = self.set_locale
self.set_button.pack(side="bottom")
......
[Desktop Entry]
Type=Application
Encoding=UTF-8
Icon=/usr/share/icons/Tango/scalable/apps/preferences-desktop-locale.svg
Exec=set-session-language
Name=Set Language for Next Session
Name=Change Language
Name[it]=Cambia la lingua
Name[de]=Sprache ändern
Comment=Change language for the next user session
Comment[it]=Cambia la lingua per la prossima sessione utente
Comment[de]=Sprache für die nächste Benutzersitzung ändern
Terminal=False
Categories=Settings;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment