Improve way to set locale

merge-requests/64/head
Hugo Posnic 2016-12-26 21:15:04 +01:00
parent 5d6143e626
commit 0a7789500b
1 changed files with 32 additions and 24 deletions

View File

@ -144,31 +144,39 @@ class ManjaroHello():
# Redfining all translatables strings # Redfining all translatables strings
# TODO: Find a better solution # TODO: Find a better solution
elts = { elts = {
"about": "tooltip_text", "comments": {
"home": "tooltip_text", "aboutdialog"
"welcometitle": "label", },
"welcomelabel": "label", "label": {
"firstcategory": "label", "autostartlabel",
"secondcategory": "label", "build",
"thirdcategory": "label", "chat",
"readme": "label", "donate",
"release": "label", "firstcategory",
"wiki": "label", "forums",
"involved": "label", "install",
"forums": "label", "installlabel",
"chat": "label", "involved",
"mailling": "label", "mailling",
"build": "label", "readme",
"donate": "label", "release",
"installlabel": "label", "secondcategory",
"install": "label", "thirdcategory",
"autostartlabel": "label", "welcomelabel",
"aboutdialog": "comments" "welcometitle",
"wiki"
},
"tooltip_text": {
"about",
"home"
} }
for elt in elts: }
for method in elts:
print(elts[method])
for elt in elts[method]:
if elt not in self.default_texts: if elt not in self.default_texts:
self.default_texts[elt] = getattr(self.builder.get_object(elt), "get_" + elts[elt])() self.default_texts[elt] = getattr(self.builder.get_object(elt), "get_" + method)()
getattr(self.builder.get_object(elt), "set_" + elts[elt])(_(self.default_texts[elt])) getattr(self.builder.get_object(elt), "set_" + method)(_(self.default_texts[elt]))
# Change content of pages # Change content of pages
for page in self.pages: for page in self.pages: