Ejemplo n.º 1
0
	def __init__(self):
		from Components.Language import language as syslanguage
		syslang = syslanguage.getLanguage()[:2]
		self.langdict = { }
		self.choices = []
		for key, val in LanguageCodes.iteritems():
			if len(key) == 2:
				self.langdict[key] = val[0]
		for key, val in self.langdict.iteritems():
			if key not in (syslang, 'en'):
				self.langdict[key] = val
				self.choices.append((key, val))
		self.choices.sort()
		self.choices.insert(0,("nolang", ("unspecified")))
		self.choices.insert(1,(syslang, self.langdict[syslang]))
		self.choices.insert(2,("en", self.langdict["en"]))
Ejemplo n.º 2
0
 def __init__(self):
     from Components.Language import language as syslanguage
     syslang = syslanguage.getLanguage()[:2]
     self.langdict = {}
     self.choices = []
     for key, val in LanguageCodes.iteritems():
         if len(key) == 2:
             self.langdict[key] = val[0]
     for key, val in self.langdict.iteritems():
         if key not in (syslang, 'en'):
             self.langdict[key] = val
             self.choices.append((key, val))
     self.choices.sort()
     self.choices.insert(0, ("nolang", ("unspecified")))
     self.choices.insert(1, (syslang, self.langdict[syslang]))
     self.choices.insert(2, ("en", self.langdict["en"]))
Ejemplo n.º 3
0
	def getLanguage(self, DVB_lang):
		DVB_lang = DVB_lang.lower()
		for word in ("stereo", "audio", "description", "2ch", "dolby digital"):
			DVB_lang = DVB_lang.replace(word,"").strip()
		for key, val in LanguageCodes.iteritems():
			if DVB_lang.find(key.lower()) == 0:
				if len(key) == 2:
					return key
				else:
					DVB_lang = (LanguageCodes[key])[0]
			elif DVB_lang.find(val[0].lower()) > -1:
				if len(key) == 2:
					return key
				else:
					DVB_lang = (LanguageCodes[key])[0]
		for key, val in self.langdict.iteritems():
			if val == DVB_lang:
				return key
		return "nolang"
Ejemplo n.º 4
0
 def getLanguage(self, DVB_lang):
     DVB_lang = DVB_lang.lower()
     for word in ("stereo", "audio", "description", "2ch", "dolby digital"):
         DVB_lang = DVB_lang.replace(word, "").strip()
     for key, val in LanguageCodes.iteritems():
         if DVB_lang.find(key.lower()) == 0:
             if len(key) == 2:
                 return key
             else:
                 DVB_lang = (LanguageCodes[key])[0]
         elif DVB_lang.find(val[0].lower()) > -1:
             if len(key) == 2:
                 return key
             else:
                 DVB_lang = (LanguageCodes[key])[0]
     for key, val in self.langdict.iteritems():
         if val == DVB_lang:
             return key
     return "nolang"