()
| 272 | |
| 273 | |
| 274 | def update_catalog_snapshots(): |
| 275 | for po_file in data_dir.glob('*.po'): |
| 276 | mo_file = po_file.with_suffix('.mo') |
| 277 | compile_messages(po_file, mo_file) |
| 278 | # Create a human-readable JSON file which is |
| 279 | # easier to review than the binary .mo file. |
| 280 | with open(mo_file, 'rb') as f: |
| 281 | translations = GNUTranslations(f) |
| 282 | catalog_file = po_file.with_suffix('.json') |
| 283 | with open(catalog_file, 'w') as f: |
| 284 | data = translations._catalog.items() |
| 285 | data = sorted(data, key=lambda x: (isinstance(x[0], tuple), x[0])) |
| 286 | json.dump(data, f, indent=4) |
| 287 | f.write('\n') |
| 288 | |
| 289 | |
| 290 | if __name__ == '__main__': |
no test coverage detected
searching dependent graphs…