add ability to remove list and config from a wizard
[enigma2.git] / lib / python / Components / Language.py
index 8d966b6..c60b39b 100644 (file)
@@ -1,9 +1,12 @@
 import gettext
 import os
 
+from Tools.Directories import *
+
 class Language:
        def __init__(self):
-               gettext.install('enigma2', '/enigma2/po')
+               gettext.install('enigma2', '/enigma2/po', unicode=1)
+               self.activeLanguage = 0
                self.lang = []
                # FIXME make list dynamically
                self.addLanguage(_("English"), "en")
@@ -11,13 +14,17 @@ class Language:
 
        def addLanguage(self, name, lang):
                try:
-                       self.lang.append((_(name), gettext.translation('enigma2', '/enigma2/po', languages=[lang])))
+                       self.lang.append((_(name), gettext.translation('enigma2', resolveFilename(SCOPE_LANGUAGE, ""), languages=[lang]), lang))
                except:
                        print "Language " + str(name) + " not found"
 
        def activateLanguage(self, index):
-               print "Activating language " + str(self.lang[index][0])
-               self.lang[index][1].install()
+               try:
+                       print "Activating language " + str(self.lang[index][0])
+                       self.lang[index][1].install()
+                       self.activeLanguage = index
+               except:
+                       print "Selected language does not exist!"
                
        def getLanguageList(self):
                list = []
@@ -25,4 +32,4 @@ class Language:
                        list.append(x[0])
                return list
 
-language = Language()
\ No newline at end of file
+language = Language()