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