initially add eUroticTV HTTP live streaming plugin
[enigma2-plugins.git] / eurotictv / src / __init__.py
1 from Components.Language import language
2 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
3 import os,gettext
4  
5 PluginLanguageDomain = "eUroticTV"
6 PluginLanguagePath = "Extensions/eUroticTV/locale"
7  
8 def localeInit():
9         lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
10         os.environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
11         #print "[%s] set language to " %(PluginLanguageDomain), lang
12         gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath))
13
14 def __(txt):
15         t = gettext.dgettext(PluginLanguageDomain, txt)
16         if t == txt:
17                 print "[%s] fallback to default translation for %s" %(PluginLanguageDomain, txt)
18                 t = _(txt)
19                 #t = gettext.gettext(txt)
20         return t
21
22 localeInit()
23 language.addCallback(localeInit)