fix path in two more places ;)
[enigma2-plugins.git] / ac3lipsync / src / __init__.py
1 from Components.Language import language
2 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
3 import os,gettext
4
5 PluginLanguageDomain = "AC3LipSync"
6 PluginLanguagePath = "Extensions/AC3LipSync/locale"
7
8 def localeInit():
9     lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
10     os.environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
11     print "[AC3LipSync] set language to ", lang
12     gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath))
13
14 def _(txt):
15     t = gettext.dgettext(PluginLanguageDomain, txt)
16     if t == txt:
17         print "[AC3LipSync] fallback to default translation for", txt
18         t = gettext.gettext(txt)
19     return t
20
21 localeInit()
22 language.addCallback(localeInit)