3 from Tools.Directories import SCOPE_LANGUAGE, resolveFilename
7 gettext.install('enigma2', resolveFilename(SCOPE_LANGUAGE, ""), unicode=0, codeset="utf-8")
8 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(_("Catalan"), "ca", "AD")
17 self.addLanguage(_("Croatian"), "hr", "HR")
18 self.addLanguage(_("Czech"), "cs", "CZ")
19 self.addLanguage(_("Danish"), "da", "DK")
20 self.addLanguage(_("Dutch"), "nl", "NL")
21 self.addLanguage(_("Finnish"), "fi", "FI")
22 self.addLanguage(_("French"), "fr", "FR")
23 self.addLanguage(_("Hungarian"), "hu", "HU")
24 self.addLanguage(_("Icelandic"), "is", "IS")
25 self.addLanguage(_("Italian"), "it", "IT")
26 self.addLanguage(_("Norwegian"), "no", "NO")
27 self.addLanguage(_("Spanish"), "es", "ES")
28 self.addLanguage(_("Swedish"), "sv", "SE")
29 self.addLanguage(_("Turkish"), "tr", "TR")
33 def addLanguage(self, name, lang, country):
35 self.lang[str(lang + "_" + country)] = ((_(name), gettext.translation('enigma2', resolveFilename(SCOPE_LANGUAGE, ""), languages=[lang]), lang, country))
36 self.langlist.append(str(lang + "_" + country))
38 print "Language " + str(name) + " not found"
40 def activateLanguage(self, index):
42 print "Activating language " + str(self.lang[index][0])
43 self.lang[index][1].install()
44 self.activeLanguage = index
45 for x in self.callbacks:
48 print "Selected language does not exist!"
50 def getLanguageList(self):
52 for x in self.langlist:
53 list.append((x, self.lang[x]))
56 def getActiveLanguage(self):
57 return self.activeLanguage
59 def getLanguage(self):
61 return str(self.lang[self.activeLanguage][2]) + "_" + str(self.lang[self.activeLanguage][3])
65 def addCallback(self, callback):
66 self.callbacks.append(callback)