Fix handling modifications to plural android strings
offlate/formats/entry.py
37 | 37 | self.msgstrs[index] = content | |
38 | 38 | ||
39 | 39 | def get(self, index): | |
40 | - | return self.msgstrs[index] | |
40 | + | if isinstance(self.msgstrs, list): | |
41 | + | return self.msgstrs[index] | |
42 | + | else: | |
43 | + | return list(self.msgstrs.items())[index][1] | |
41 | 44 | ||
42 | 45 | class POEntry(Entry): | |
43 | 46 | def __init__(self, entry): |
offlate/ui/editor.py
322 | 322 | item.setText(1, msgstr.replace('\n', ' ')) | |
323 | 323 | else: | |
324 | 324 | i = 0 | |
325 | - | for msgstr in data.msgstrs: | |
326 | - | data.update(i, self.msgstr.widget(i).toPlainText()) | |
325 | + | for msgstr in (data.msgstrs if isinstance(data.msgstrs, list) else \ | |
326 | + | list(data.msgstrs.keys())): | |
327 | + | data.update(i if isinstance(data.msgstrs, list) else msgstr, | |
328 | + | self.msgstr.widget(i).toPlainText()) | |
327 | 329 | i=i+1 | |
328 | 330 | item.setText(1, data.get(0).replace('\n', ' ')) | |
329 | 331 | item.setForeground(1, QBrush()) |