Skip to content

Commit

Permalink
Merge pull request #654 from Huevos/DEV
Browse files Browse the repository at this point in the history
PluginLanguageDomain
  • Loading branch information
Captain committed Mar 19, 2017
2 parents 96f770d + aebd046 commit 89c344d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/python/Screens/Setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
from Components.Sources.Boolean import Boolean

from enigma import eEnv
from gettext import dgettext
from boxbranding import getMachineBrand, getMachineName

import xml.etree.cElementTree

def setupdom(plugin=None):
# read the setupmenu
try:
if plugin:
# first we search in the current path
setupfile = file(resolveFilename(SCOPE_CURRENT_PLUGIN, plugin + '/setup.xml'), 'r')
except:
else:
# if not found in the current path, we use the global datadir-path
setupfile = file(eEnv.resolve('${datadir}/enigma2/setup.xml'), 'r')
setupfiledom = xml.etree.cElementTree.parse(setupfile)
Expand Down Expand Up @@ -92,7 +93,7 @@ def refill(self, list):
self.setup_title = x.get("title", "").encode("UTF-8")
self.seperation = int(x.get('separation', '0'))

def __init__(self, session, setup, plugin=None):
def __init__(self, session, setup, plugin=None, PluginLanguageDomain=None):
Screen.__init__(self, session)
# for the skin: first try a setup_<setupID>, then Setup
self.skinName = ["setup_" + setup, "Setup" ]
Expand All @@ -106,6 +107,7 @@ def __init__(self, session, setup, plugin=None):
self.item = None
self.setup = setup
self.plugin = plugin
self.PluginLanguageDomain = PluginLanguageDomain
list = []
self.onNotifiers = [ ]
self.refill(list)
Expand Down Expand Up @@ -256,9 +258,14 @@ def addItems(self, list, parentNode):
if requires and not SystemInfo.get(requires, False):
continue

item_text = _(x.get("text", "??").encode("UTF-8"))
if self.PluginLanguageDomain:
item_text = dgettext(self.PluginLanguageDomain, x.get("text", "??").encode("UTF-8"))
item_description = dgettext(self.PluginLanguageDomain, x.get("description", " ").encode("UTF-8"))
else:
item_text = _(x.get("text", "??").encode("UTF-8"))
item_description = _(x.get("description", " ").encode("UTF-8"))

item_text = item_text.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName()))
item_description = _(x.get("description", " ").encode("UTF-8"))
item_description = item_description.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName()))
b = eval(x.text or "")
if b == "":
Expand Down

0 comments on commit 89c344d

Please sign in to comment.