|
|
|
@ -33,6 +33,7 @@ class Translation(Data):
|
|
|
|
|
self.source = ""
|
|
|
|
|
self.targetLang = ""
|
|
|
|
|
self.explanation = ""
|
|
|
|
|
self.explanationList = []
|
|
|
|
|
self.tags = []
|
|
|
|
|
|
|
|
|
|
def import_xml(self, translation_xml):
|
|
|
|
@ -43,11 +44,15 @@ class Translation(Data):
|
|
|
|
|
self.source = translation.getAttribute("source") if translation.hasAttribute("source") else ""
|
|
|
|
|
self.targetLang = translation.getAttribute("targetLang") if translation.hasAttribute("targetLang") else ""
|
|
|
|
|
|
|
|
|
|
explanationList = translation_xml.querySelectorAll("explanationList explanation")
|
|
|
|
|
|
|
|
|
|
for explanation in explanationList:
|
|
|
|
|
self.explanationList.append(explanation.textContent if explanation else "")
|
|
|
|
|
|
|
|
|
|
explanation = translation_xml.querySelector("explanation")
|
|
|
|
|
self.explanation = explanation.textContent if explanation else ""
|
|
|
|
|
self.tags = import_label_list("labelList label", translation_xml)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def view(self, model):
|
|
|
|
|
elements = []
|
|
|
|
|
|
|
|
|
@ -62,7 +67,9 @@ class Translation(Data):
|
|
|
|
|
elements.append(h("span.translation-source", {}, self.source))
|
|
|
|
|
|
|
|
|
|
explanation_class = ".translation-explanation" if self.translation else ""
|
|
|
|
|
elements.append(h("span{}".format(explanation_class), {}, self.explanation))
|
|
|
|
|
|
|
|
|
|
# elements.append(h("span{}".format(explanation_class), {}, self.explanations))
|
|
|
|
|
elements.append(h("span{}".format(explanation_class), {}, ", ".join(self.explanationList)))
|
|
|
|
|
|
|
|
|
|
return h("div.translation-div", {"on": {"click": M.msg(M.ShowTranslationMenu, self) }}, elements)
|
|
|
|
|
|
|
|
|
|