add Link to WebTv to Standard Webinterface (which gives a bigger base of Betatesters)
[enigma2-plugins.git] / webinterface / src / __init__.py
1 import Plugins.Plugin
2 from Components.config import config
3 from Components.config import ConfigSubsection
4 from Components.config import ConfigSelection
5 from Components.config import ConfigInteger
6 from Components.config import ConfigSubList
7 from Components.config import ConfigSubDict
8 from Components.config import ConfigText
9 from Components.config import configfile
10 from Components.config import ConfigYesNo
11 from Components.Language import language
12 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
13 import os,gettext
14
15 __version__ = "1.5beta3"
16
17 PluginLanguageDomain = "WebInterface"
18 PluginLanguagePath = "Extensions/WebInterface/locale"
19
20 def localeInit():
21         lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
22         os.environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
23         print "[WebInterface] set language to ", lang
24         gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath))
25
26 def _(txt):
27         t = gettext.dgettext(PluginLanguageDomain, txt)
28         if t == txt:
29                 print "[WebInterface] fallback to default translation for", txt
30                 t = gettext.gettext(txt)
31         return t
32
33 localeInit()
34 language.addCallback(localeInit)