mirror of https://github.com/jetkvm/kvm.git
22 lines
725 B
Python
22 lines
725 B
Python
#!/usr/bin/env python3
|
|
import json
|
|
from pathlib import Path
|
|
|
|
messages_dir = Path(__file__).resolve().parent.parent / 'ui' / 'localization' / 'messages'
|
|
files = list(messages_dir.glob('*.json'))
|
|
|
|
for f in files:
|
|
data = json.loads(f.read_text(encoding='utf-8'))
|
|
# Keep $schema first if present
|
|
schema = None
|
|
if '$schema' in data:
|
|
schema = data.pop('$schema')
|
|
sorted_items = dict(sorted(data.items()))
|
|
if schema is not None:
|
|
out = {'$schema': schema}
|
|
out.update(sorted_items)
|
|
else:
|
|
out = sorted_items
|
|
f.write_text(json.dumps(out, ensure_ascii=False, indent=4) + '\n', encoding='utf-8')
|
|
print(f'Processed {len(files)} files in {messages_dir}')
|