Change import/export for translation: source&targetLang
This commit is contained in:
parent
4c7ade67fc
commit
16a2059a37
|
@ -129,6 +129,8 @@ def export_translation(doc, translation):
|
||||||
|
|
||||||
actual_t = doc.createElement("translation")
|
actual_t = doc.createElement("translation")
|
||||||
actual_t.textContent = translation.translation
|
actual_t.textContent = translation.translation
|
||||||
|
actual_t.setAttribute("targetLang", translation.targetLang)
|
||||||
|
|
||||||
if translation.source:
|
if translation.source:
|
||||||
actual_t.setAttribute("source", translation.source)
|
actual_t.setAttribute("source", translation.source)
|
||||||
translation_xml.appendChild(actual_t)
|
translation_xml.appendChild(actual_t)
|
||||||
|
|
|
@ -5,8 +5,9 @@ from model.editable import Editable
|
||||||
class Translation(Editable):
|
class Translation(Editable):
|
||||||
def __init__(self, translation_xml):
|
def __init__(self, translation_xml):
|
||||||
translation = translation_xml.querySelector("translation")
|
translation = translation_xml.querySelector("translation")
|
||||||
self.translation = translation.textContent if translation else ""
|
self.translation = translation.textContent
|
||||||
self.source = translation.getAttribute("source") if translation else ""
|
self.source = translation.getAttribute("source") if translation.hasAttribute("source") else ""
|
||||||
|
self.targetLang = translation.getAttribute("targetLang") if translation.hasAttribute("targetLang") else ""
|
||||||
|
|
||||||
explanation = translation_xml.querySelector("explanation")
|
explanation = translation_xml.querySelector("explanation")
|
||||||
self.explanation = explanation.textContent if explanation else ""
|
self.explanation = explanation.textContent if explanation else ""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user