You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lexonomy_custom_editor/src/model/translation.py

22 lines
870 B

from model.tags import import_label_list
from model.editable import Editable
class Translation(Editable):
def __init__(self, translation_xml):
translation = translation_xml.querySelector("translation")
if translation:
self.translation = translation.textContent
self.source = translation.getAttribute("source") if translation.hasAttribute("source") else ""
self.targetLang = translation.getAttribute("targetLang") if translation.hasAttribute("targetLang") else ""
else:
self.translation = ""
self.source = ""
self.targetLang = ""
explanation = translation_xml.querySelector("explanation")
self.explanation = explanation.textContent if explanation else ""
self.tags = import_label_list("labelList label", translation_xml)