support fuzzy and obsolete flags in ts entries

Julien LepillerSat Aug 24 21:50:17+0200 2019

6fb8302

support fuzzy and obsolete flags in ts entries

offlate/formats/entry.py

8585
        numerus = entry.get('numerus') == 'yes'
8686
        sourcestring = ""
8787
        translation = [] if numerus else ""
88+
        translationtype = None
8889
        for child in entry:
8990
            if child.tag == "source":
9091
                sourcestring = child.text
9192
            elif child.tag == "translation":
93+
                translationtype = child.get('type')
9294
                if numerus:
9395
                    for form in child:
9496
                        translation.append(form.text)

99101
        else:
100102
            translation = [translation]
101103
            sourcestring = [sourcestring]
102-
        Entry.__init__(self, sourcestring, translation, False, False)
104+
        fuzzy = False
105+
        obsolete = False
106+
        if translationtype == 'obsolete':
107+
            obsolete = True
108+
        if translationtype == 'unfinished':
109+
            fuzzy = True
110+
        Entry.__init__(self, sourcestring, translation, fuzzy, obsolete)
103111
104112
    def update(self, index, content):
105113
        Entry.update(self, index, content)