Fix ts item update
offlate/formats/entry.py
118 | 118 | if child.tag == "translation": | |
119 | 119 | if numerus: | |
120 | 120 | i=0 | |
121 | + | self.fuzzy = False | |
121 | 122 | for form in child: | |
122 | 123 | if i == index: | |
123 | 124 | form.text = content | |
124 | - | break | |
125 | + | if form.text == '': | |
126 | + | self.fuzzy = True | |
125 | 127 | i = i + 1 | |
126 | 128 | else: | |
127 | 129 | child.text = content | |
130 | + | self.fuzzy = content == "" |
offlate/formats/ts.py
267 | 267 | for child in item: | |
268 | 268 | if child.tag == "translation": | |
269 | 269 | if numerus: | |
270 | - | i = 0 | |
271 | - | for form in child: | |
272 | - | form.text = msgstrs[i] | |
273 | - | i += 1 | |
270 | + | child.clear() | |
271 | + | unfinished = False | |
272 | + | for i in range(0, int(get_nplurals(self.conf['lang']))): | |
273 | + | e = ET.Element('numerusform') | |
274 | + | e.text = msgstrs[i] | |
275 | + | child.append(e) | |
276 | + | unfinished = unfinished or msgstrs[i] == '' | |
277 | + | if unfinished: | |
278 | + | child.set('type', 'unfinished') | |
274 | 279 | else: | |
280 | + | if msgstrs[0] != "": | |
281 | + | child.clear() | |
282 | + | else: | |
283 | + | child.set('type', 'unfinished') | |
275 | 284 | child.text = msgstrs[0] | |
276 | 285 | break | |
277 | 286 | root.append(context) |