fix po/Makefile.am to copy .mo files instead of .po
[enigma2.git] / 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                 self["list"] = LanguageList(self.list)
16                 self.updateList()
17                 
18                 self["actions"] = ActionMap(["WizardActions"], 
19                 {
20                         "ok": self.save,
21                         "back": self.close,
22                         "up": self.up,
23                         "down": self.down
24                 }, -1)
25                 
26         def save(self):
27                 self.run()
28                 self.close()
29         
30         def run(self):
31                 language.activateLanguage(self["list"].l.getCurrentSelectionIndex())
32                 config.osd.language.value = self["list"].l.getCurrentSelectionIndex()
33                 config.osd.language.save()
34
35         def updateList(self):
36                 self.list = []
37                 if len(language.lang) == 0: # no language available => display only english
38                         self.list.append(LanguageEntryComponent("en", _("English")))
39                 else:
40                         for x in language.lang:
41                                 self.list.append(LanguageEntryComponent(x[2], _(x[0])))
42                 
43                 self["list"].l.setList(self.list)
44                 
45         def up(self):
46                 self["list"].instance.moveSelection(self["list"].instance.moveUp)
47                 self.run()
48                 self.updateList()
49                 
50         def down(self):
51                 self["list"].instance.moveSelection(self["list"].instance.moveDown)
52                 self.run()
53                 self.updateList()