example translations and sense translation now unified, should behave very simmilary
- import - export - view - edite translation events
This commit is contained in:
@@ -2,6 +2,25 @@ from model.tags import import_label_list
|
||||
from model.editable import Editable
|
||||
|
||||
|
||||
def from_container_list(translation_list_container_xml):
|
||||
translations = []
|
||||
max_num_cluster = 0
|
||||
|
||||
for translation_xml in translation_list_container_xml:
|
||||
num_cluster = 1 # default cluster
|
||||
if translation_xml.hasAttribute("cluster"):
|
||||
num_cluster = int(translation_xml.getAttribute("cluster"))
|
||||
|
||||
max_num_cluster = max(max_num_cluster, num_cluster)
|
||||
translations.append((num_cluster, Translation(translation_xml)))
|
||||
|
||||
result = [[] for _ in range(max_num_cluster)]
|
||||
for clusterNum, translation in translations:
|
||||
result[clusterNum - 1].append(translation)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
class Translation(Editable):
|
||||
def __init__(self, translation_xml):
|
||||
translation = translation_xml.querySelector("translation")
|
||||
|
||||
Reference in New Issue
Block a user