Merge branch 'master' into master_internal
[enigma2-plugins.git] / moviecut / src_py / __init__.py
1 # -*- coding: utf-8 -*-
2
3 from Components.Language import language
4 from Tools.Directories import resolveFilename, SCOPE_PLUGINS
5 import os, gettext
6
7 PluginLanguageDomain = "MovieCut"
8 PluginLanguagePath = "Extensions/MovieCut/locale"
9
10 def localeInit():
11         lang = language.getLanguage()[:2]
12         os.environ["LANGUAGE"] = lang
13         print "[MovieCut] set language to ", lang
14         gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath))
15
16 def _(txt):
17         t = gettext.dgettext(PluginLanguageDomain, txt)
18         if t == txt:
19                 print "[MovieCut] fallback to default Enigma2 Translation for", txt
20                 t = gettext.gettext(txt)
21         return t
22
23 localeInit()
24 language.addCallback(localeInit)