()
| 137 | |
| 138 | |
| 139 | def update_catalog_snapshots(): |
| 140 | for po_file in data_dir.glob('*.po'): |
| 141 | mo_file = po_file.with_suffix('.mo') |
| 142 | compile_messages(po_file, mo_file) |
| 143 | # Create a human-readable JSON file which is |
| 144 | # easier to review than the binary .mo file. |
| 145 | with open(mo_file, 'rb') as f: |
| 146 | translations = GNUTranslations(f) |
| 147 | catalog_file = po_file.with_suffix('.json') |
| 148 | with open(catalog_file, 'w') as f: |
| 149 | data = translations._catalog.items() |
| 150 | data = sorted(data, key=lambda x: (isinstance(x[0], tuple), x[0])) |
| 151 | json.dump(data, f, indent=4) |
| 152 | f.write('\n') |
| 153 | |
| 154 | |
| 155 | if __name__ == '__main__': |
no test coverage detected