Simplify setting of locale
parent
2c3d141b64
commit
1129a578e8
|
@ -81,12 +81,11 @@ class ManjaroHello():
|
||||||
self.default_locale = "en"
|
self.default_locale = "en"
|
||||||
self.sys_locale = locale.getdefaultlocale()[0]
|
self.sys_locale = locale.getdefaultlocale()[0]
|
||||||
self.default_texts = {}
|
self.default_texts = {}
|
||||||
self.preferences["locale"] = self.get_best_locale()
|
|
||||||
|
|
||||||
# Make translation
|
# Make translation
|
||||||
gettext.bindtextdomain(self.app, self.locale_path)
|
gettext.bindtextdomain(self.app, self.locale_path)
|
||||||
gettext.textdomain(self.app)
|
gettext.textdomain(self.app)
|
||||||
self.builder.get_object("languages").set_active_id(self.preferences["locale"])
|
self.builder.get_object("languages").set_active_id(self.get_best_locale())
|
||||||
|
|
||||||
# Load images
|
# Load images
|
||||||
for img in ("google+", "facebook", "twitter", "reddit"):
|
for img in ("google+", "facebook", "twitter", "reddit"):
|
||||||
|
@ -182,6 +181,8 @@ class ManjaroHello():
|
||||||
label = child.get_children()[0].get_children()[0]
|
label = child.get_children()[0].get_children()[0]
|
||||||
label.set_markup(self.get_page(page))
|
label.set_markup(self.get_page(page))
|
||||||
|
|
||||||
|
self.preferences["locale"] = locale
|
||||||
|
|
||||||
def set_autostart(self, autostart):
|
def set_autostart(self, autostart):
|
||||||
"""Set state of autostart.
|
"""Set state of autostart.
|
||||||
:param autostart: wanted autostart state
|
:param autostart: wanted autostart state
|
||||||
|
@ -242,8 +243,7 @@ class ManjaroHello():
|
||||||
# Handlers
|
# Handlers
|
||||||
def on_languages_changed(self, combobox):
|
def on_languages_changed(self, combobox):
|
||||||
"""Event for selected language."""
|
"""Event for selected language."""
|
||||||
self.preferences["locale"] = combobox.get_active_id()
|
self.set_locale(combobox.get_active_id())
|
||||||
self.set_locale(self.preferences["locale"])
|
|
||||||
|
|
||||||
def on_action_clicked(self, action, _=None):
|
def on_action_clicked(self, action, _=None):
|
||||||
"""Event for differents actions."""
|
"""Event for differents actions."""
|
||||||
|
|
Loading…
Reference in New Issue