4 from Tools.Directories import *
8 gettext.install('enigma2', resolveFilename(SCOPE_LANGUAGE, ""), unicode=0, codeset="utf-8")
9 self.activeLanguage = 0
11 # FIXME make list dynamically
12 # name, iso-639 language, iso-3166 country. Please don't mix language&country!
13 self.addLanguage(_("English"), "en", "EN")
14 self.addLanguage(_("German"), "de", "DE")
15 self.addLanguage(_("Arabic"), "ar", "AE")
16 self.addLanguage(_("Dutch"), "nl", "NL")
17 self.addLanguage(_("Spanish"), "es", "ES")
18 self.addLanguage(_("Icelandic"), "is", "IS")
22 def addLanguage(self, name, lang, country):
24 self.lang[str(lang + "_" + country)] = ((_(name), gettext.translation('enigma2', resolveFilename(SCOPE_LANGUAGE, ""), languages=[lang]), lang, country))
26 print "Language " + str(name) + " not found"
28 def activateLanguage(self, index):
30 print "Activating language " + str(self.lang[index][0])
31 self.lang[index][1].install()
32 self.activeLanguage = index
33 for x in self.callbacks:
36 print "Selected language does not exist!"
38 def getLanguageList(self):
40 for x in self.lang.keys():
41 list.append((x, self.lang[x]))
44 def getActiveLanguage(self):
45 return self.activeLanguage
47 def getLanguage(self):
48 return str(self.lang[self.activeLanguage][2]) + "_" + str(self.lang[self.activeLanguage][3])
50 def addCallback(self, callback):
51 self.callbacks.append(callback)