utility: return all msgids in .po file as a list of strings
(self, data)
| 64 | return headers |
| 65 | |
| 66 | def get_msgids(self, data): |
| 67 | """ utility: return all msgids in .po file as a list of strings """ |
| 68 | msgids = [] |
| 69 | reading_msgid = False |
| 70 | cur_msgid = [] |
| 71 | for line in data.split('\n'): |
| 72 | if reading_msgid: |
| 73 | if line.startswith('"'): |
| 74 | cur_msgid.append(line.strip('"')) |
| 75 | else: |
| 76 | msgids.append('\n'.join(cur_msgid)) |
| 77 | cur_msgid = [] |
| 78 | reading_msgid = False |
| 79 | continue |
| 80 | if line.startswith('msgid '): |
| 81 | line = line[len('msgid '):] |
| 82 | cur_msgid.append(line.strip('"')) |
| 83 | reading_msgid = True |
| 84 | else: |
| 85 | if reading_msgid: |
| 86 | msgids.append('\n'.join(cur_msgid)) |
| 87 | |
| 88 | return msgids |
| 89 | |
| 90 | def assert_POT_equal(self, expected, actual): |
| 91 | """Check if two POT files are equal""" |
no test coverage detected