remove annoying "fallback" message
[enigma2-plugins.git] / epgrefresh / 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("EPGRefresh", resolveFilename(SCOPE_PLUGINS, "Extensions/EPGRefresh/locale"))
11
12 def _(txt):
13         t = gettext.dgettext("EPGRefresh", txt)
14         if t == txt:
15                 t = gettext.gettext(txt)
16         return t
17
18 localeInit()
19 language.addCallback(localeInit)
20