Add info to po format

Julien LepillerThu Dec 09 01:40:35+0100 2021

05fb097

Add info to po format

offlate/formats/entry.py

105105
            for msgstr in entry.msgstr_plural:
106106
                msgstrs.append(entry.msgstr_plural[msgstr])
107107
            msgids = [entry.msgid, entry.msgid_plural]
108-
        Entry.__init__(self, msgids, msgstrs, "fuzzy" in entry.flags, entry.obsolete)
108+
        info = []
109+
        for o in entry.occurrences:
110+
            info.append({'type': 'location', 'file': o[0], 'line': o[1]})
111+
        if entry.comment is not None and entry.comment != '':
112+
            info.append({'type': 'comment', 'comment': entry.comment})
113+
        if entry.tcomment is not None and entry.tcomment != '':
114+
            info.append({'type': 'comment', 'comment': entry.tcomment})
115+
        Entry.__init__(self, msgids, msgstrs, "fuzzy" in entry.flags, entry.obsolete, info)
109116
        self.entry = entry
110117
111118
    def update(self, index, content):

offlate/ui/editor.py

366366
        label.setWordWrap(True)
367367
        if info['type'] == 'location':
368368
            label.setText(self.tr('<b>location</b>: {0} line {1}'.format(info['file'], info['line'])))
369+
        if info['type'] == 'comment':
370+
            label.setText(self.tr('<b>comment</b>: {0}'.format(info['comment'])))
369371
        return label
370372
371373
    def modify(self):