ts: save obsolete flag

Julien LepillerSun Aug 29 23:01:17+0200 2021

29a8e98

ts: save obsolete flag

CHANGELOG.md

55
66
### Improvements and features ###
77
8+
* Fixed TS format not setting the obsolete flag when saving.
89
* Whitespace characters are shown with a small symbol in the editor. Spaces get
910
  a small middle dot, no-break spaces get a line underneath. Tabs are also represented.
1011
* Some improvements have been made to the code documentation.

offlate/formats/ts.py

260260
                                sourcestring = child.text
261261
                                break
262262
                        msgstrs = []
263+
                        obsolete = False
263264
                        for entry in self.savedcontent:
264265
                            if entry.msgids[0] == sourcestring:
265266
                                msgstrs = entry.msgstrs
267+
                                obsolete = entry.isObsolete()
266268
                        for child in item:
267269
                            if child.tag == "translation":
268270
                                if numerus:

273275
                                        e.text = msgstrs[i]
274276
                                        child.append(e)
275277
                                        unfinished = unfinished or msgstrs[i] == ''
276-
                                    if unfinished:
278+
                                    if obsolete or child.get('type') == 'obsolete':
279+
                                        child.set('type', 'obsolete')
280+
                                    elif unfinished:
277281
                                        child.set('type', 'unfinished')
278282
                                else:
279-
                                    if msgstrs[0] != "":
283+
                                    if obsolete or child.get('type') == 'obsolete':
284+
                                        child.set('type', 'obsolete')
285+
                                    elif msgstrs[0] != "":
280286
                                        child.clear()
281287
                                    else:
282288
                                        child.set('type', 'unfinished')