moved _ function (gettext) to package init
authorAlex Lätsch <lexx911@users.schwerkraft.elitedvb.net>
Sun, 22 Jun 2008 12:54:16 +0000 (12:54 +0000)
committerAlex Lätsch <lexx911@users.schwerkraft.elitedvb.net>
Sun, 22 Jun 2008 12:54:16 +0000 (12:54 +0000)
vlcplayer/src/__init__.py
vlcplayer/src/plugin.py

index 580443f..16071f5 100755 (executable)
@@ -16,8 +16,15 @@ import os,gettext
 def localeInit():
        lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
        os.environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
-       #gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE))
-       #gettext.textdomain("enigma2")
+       gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE))
+       gettext.textdomain("enigma2")
        gettext.bindtextdomain("VlcPlayer", resolveFilename(SCOPE_PLUGINS, "Extensions/VlcPlayer/locale"))
 
+def _(txt):
+       t = gettext.dgettext("VlcPlayer", txt)
+       if t == txt:
+               print "[VLC] fallback to default translation for", txt
+               t = gettext.gettext(txt)
+       return t
+
 localeInit()
index fa572a7..61ed7c5 100755 (executable)
@@ -14,17 +14,21 @@ from Plugins.Plugin import PluginDescriptor
 from Tools.BoundFunction import boundFunction
 
 from VlcServerList import VlcServerListScreen
-from VlcServerConfig import vlcPluginInfo
+import gettext
 
+def _(txt):
+       t = gettext.dgettext("VlcPlayer", txt)
+       if t == txt:
+               print "[VLC] fallback to default translation for", txt
+               t = gettext.gettext(txt)
+       return t
 
 def main(session, **kwargs):
        session.open(VlcServerListScreen)
 
-
 def Plugins(**kwargs):
-       vlcPluginInfo.pluginPath = kwargs["path"]
        return PluginDescriptor(
                name="VLC Video Player",
                description="VLC Video Player",
                where = [ PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_PLUGINMENU ],
-               icon = "plugin.png", fnc = boundFunction(main, path = kwargs["path"]))
+               icon = "plugin.png", fnc = boundFunction(main))