minify override_ko.json

This commit is contained in:
Seunghoon Lee
2025-02-10 14:35:55 +09:00
parent 510ff7e0bf
commit a671501bff
2 changed files with 30 additions and 1266 deletions
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env python
# Remove the entries that no longer exist in locale from override.
import sys
import json
from rich import print # pylint: disable=redefined-builtin
if __name__ == "__main__":
sys.argv.pop(0)
if len(sys.argv) == 0:
print('Invalid parameters.')
sys.exit(1)
filename = sys.argv[0]
labels = []
override = None
try:
with open('html/locale_en.json', 'r', encoding="utf-8") as f:
locale = json.load(f)
for v in locale.values():
for item in v:
labels.append(item['label'])
with open(filename, 'r', encoding="utf-8") as f:
override = json.load(f)
except Exception:
print('Invalid file format.')
sys.exit(1)
with open(filename, 'w', encoding="utf-8") as f:
json.dump([item for item in override if item['label'] in labels], f, ensure_ascii=False)
+1 -1266
View File
File diff suppressed because one or more lines are too long