add some translations (translations in the wizard don't work in some places)
[vuplus_dvbapp] / lib / python / Screens / LanguageSelection.py
1 from Screen import Screen
2
3 from Components.MenuList import MenuList
4 from Components.ActionMap import ActionMap
5 from Components.Language import language
6 from Components.LanguageList import *
7 from Components.config import config
8
9
10 class LanguageSelection(Screen):
11         def __init__(self, session):
12                 Screen.__init__(self, session)
13                 
14                 self.list = []
15                 if len(language.lang) == 0: # no language available => display only english
16                         self.list.append(LanguageEntryComponent("en", _("English")))
17                 else:
18                         for x in language.lang:
19                                 self.list.append(LanguageEntryComponent(x[2], x[0]))
20                 
21                 self["list"] = LanguageList(self.list)
22                 
23                 self["actions"] = ActionMap(["OkCancelActions"], 
24                 {
25                         "ok": self.save,
26                         "cancel": self.close
27                 })
28                 
29         def save(self):
30                 self.run()
31                 self.close()
32         
33         def run(self):
34                 language.activateLanguage(self["list"].l.getCurrentSelectionIndex())
35                 config.osd.language.value = self["list"].l.getCurrentSelectionIndex()
36                 config.osd.language.save()