utility: return the header of a .po file as a dictionary
(self, data)
| 53 | script = Path(toolsdir, 'i18n', 'pygettext.py') |
| 54 | |
| 55 | def get_header(self, data): |
| 56 | """ utility: return the header of a .po file as a dictionary """ |
| 57 | headers = {} |
| 58 | for line in data.split('\n'): |
| 59 | if not line or line.startswith(('#', 'msgid', 'msgstr')): |
| 60 | continue |
| 61 | line = line.strip('"') |
| 62 | key, val = line.split(':', 1) |
| 63 | headers[key] = val.strip() |
| 64 | return headers |
| 65 | |
| 66 | def get_msgids(self, data): |
| 67 | """ utility: return all msgids in .po file as a list of strings """ |
no test coverage detected