4 from Tools.Directories import *
8 gettext.install('enigma2', resolveFilename(SCOPE_LANGUAGE, ""), unicode=0, codeset="utf-8")
9 self.activeLanguage = 0
12 # FIXME make list dynamically
13 # name, iso-639 language, iso-3166 country. Please don't mix language&country!
14 self.addLanguage(_("English"), "en", "EN")
15 self.addLanguage(_("German"), "de", "DE")
16 self.addLanguage(_("Arabic"), "ar", "AE")
17 self.addLanguage(_("Catalan"), "ca", "AD")
18 self.addLanguage(_("Croatian"), "hr", "HR")
19 self.addLanguage(_("Czech"), "cs", "CZ")
20 self.addLanguage(_("Danish"), "da", "DK")
21 self.addLanguage(_("Dutch"), "nl", "NL")
22 self.addLanguage(_("Finnish"), "fi", "FI")
23 self.addLanguage(_("French"), "fr", "FR")
24 self.addLanguage(_("Hungarian"), "hu", "HU")
25 self.addLanguage(_("Icelandic"), "is", "IS")
26 self.addLanguage(_("Italian"), "it", "IT")
27 self.addLanguage(_("Norwegian"), "no", "NO")
28 self.addLanguage(_("Spanish"), "es", "ES")
29 self.addLanguage(_("Swedish"), "sv", "SE")
30 self.addLanguage(_("Turkish"), "tr", "TR")
34 def addLanguage(self, name, lang, country):
36 self.lang[str(lang + "_" + country)] = ((_(name), gettext.translation('enigma2', resolveFilename(SCOPE_LANGUAGE, ""), languages=[lang]), lang, country))
37 self.langlist.append(str(lang + "_" + country))
39 print "Language " + str(name) + " not found"
41 def activateLanguage(self, index):
43 print "Activating language " + str(self.lang[index][0])
44 self.lang[index][1].install()
45 self.activeLanguage = index
46 for x in self.callbacks:
49 print "Selected language does not exist!"
51 def getLanguageList(self):
53 for x in self.langlist:
54 list.append((x, self.lang[x]))
57 def getActiveLanguage(self):
58 return self.activeLanguage
60 def getLanguage(self):
62 return str(self.lang[self.activeLanguage][2]) + "_" + str(self.lang[self.activeLanguage][3])
66 def addCallback(self, callback):
67 self.callbacks.append(callback)