Merge branch 'refs/heads/master' of ssh://sreichholf@scm.schwerkraft.elitedvb.net...
[enigma2-plugins.git] / serienfilm / 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. "de_DE" 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("SerienFilm", resolveFilename(SCOPE_PLUGINS, "Extensions/SerienFilm/locale"))
11
12
13 def _x(txt):
14         t = gettext.dgettext("SerienFilm", txt)
15         if t == txt:
16                 t = gettext.gettext(txt)
17 #               print "[SF-Plugin] gettext >%s< = >%s<" % (txt, t)
18         return t
19
20 localeInit()
21 language.addCallback(localeInit)
22