1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-25 05:52:50 -05:00

i18n: general term cleanup, add missing terms, interpolate some

This commit is contained in:
bbedward
2025-12-18 16:19:27 -05:00
parent baf23157fc
commit 2a91bc41f7
30 changed files with 1540 additions and 421 deletions

View File

@@ -243,7 +243,7 @@ def save_sync_state():
def main():
if len(sys.argv) < 2:
error("Usage: i18nsync.py [check|sync|test]")
error("Usage: i18nsync.py [check|sync|test|local]")
command = sys.argv[1]
@@ -315,6 +315,39 @@ def main():
save_sync_state()
info("Already in sync")
elif command == "local":
info("Updating en.json locally (no POEditor sync)")
old_en = normalize_json(EN_JSON)
old_terms = {entry['term']: entry for entry in old_en} if isinstance(old_en, list) else {}
extract_strings()
new_en = normalize_json(EN_JSON)
new_terms = {entry['term']: entry for entry in new_en} if isinstance(new_en, list) else {}
added = set(new_terms.keys()) - set(old_terms.keys())
removed = set(old_terms.keys()) - set(new_terms.keys())
if added:
info(f"\n+{len(added)} new terms:")
for term in sorted(added)[:20]:
print(f" + {term[:60]}...")
if len(added) > 20:
print(f" ... and {len(added) - 20} more")
if removed:
info(f"\n-{len(removed)} removed terms:")
for term in sorted(removed)[:20]:
print(f" - {term[:60]}...")
if len(removed) > 20:
print(f" ... and {len(removed) - 20} more")
success(f"\n{len(new_en)} total terms")
if not added and not removed:
info("No changes detected")
else:
error(f"Unknown command: {command}")