SeriesPlugin 1.0: First public version
[enigma2-plugins.git] / seriesplugin / src / __init__.py
1 from Components.Language import language
2 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
3 from os import environ as os_environ
4 import gettext
5
6 def localeInit():
7         lang = language.getLanguage()[:2]  # getLanguage returns e.g. "fi_FI" for "language_country"
8         os_environ["LANGUAGE"] = lang      # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
9         gettext.bindtextdomain("SeriesPlugin", resolveFilename(SCOPE_PLUGINS, "Extensions/SeriesPlugin/locale"))
10
11 _ = lambda txt: gettext.dgettext("SeriesPlugin", txt) if txt else ""
12
13 localeInit()
14 language.addCallback(localeInit)