new detection-support in auto-3d-option:
[enigma2-plugins.git] / 3dsettings / src / __init__.py
1 # -*- coding: utf-8 -*-
2 from Components.Language import language
3 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
4 import os,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("3DSettings", resolveFilename(SCOPE_PLUGINS, "SystemPlugins/3DSettings/locale"))
10
11 def _(txt):
12         t = gettext.dgettext("3DSettings", txt)
13         if t == txt:
14                 print "[3DSettings] fallback to default translation for", txt
15                 t = gettext.gettext(txt)
16         return t
17
18 localeInit()
19 language.addCallback(localeInit)