[MerlinEPG] new crossover EPG list added to TV-button.
[vuplus_dvbapp-plugin] / mediadownloader / src / __init__.py
1 # -*- coding: utf-8 -*-
2 from Components.Language import language
3 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
4 from os import environ as os_environ
5 import gettext
6
7 def localeInit():
8         lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
9         os_environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
10         gettext.bindtextdomain("MediaDownloader", resolveFilename(SCOPE_PLUGINS, "Extensions/MediaDownloader/"))
11
12 def _(txt):
13         t = gettext.dgettext("MediaDownloader", txt)
14         if t == txt:
15                 print "[MediaDownloader] fallback to default translation for", txt
16                 t = gettext.gettext(txt)
17         return t
18
19 localeInit()
20 language.addCallback(localeInit)
21