add a tool to find missing i18n key in two files

This commit is contained in:
Audric Ackermann 2020-08-07 08:44:46 +10:00
parent c41a064880
commit 1f7cfc357b
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4
1 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,30 @@
#!/bin/python3
# usage : ./tools/compareLocalizedStrings.py en de
import re
import os
from glob import glob
import json
import sys
if len(sys.argv) != 3:
print(f'usage: {sys.argv[0]} <source_local> <compare_local>')
sys.exit(1)
src = sys.argv[1]
dest = sys.argv[2]
print(f'src {src}, dest {dest}')
jsonInEn = json.loads(open(f'_locales/{src}/messages.json', 'r').read())
jsonInDe = json.loads(open(f'_locales/{dest}/messages.json', 'r').read())
keysInEn = jsonInEn.keys()
keysInDe = jsonInDe.keys()
print(keysInEn)
for key in keysInEn:
if key not in keysInDe:
print(f'not found in de:{key}')
print(f'total keys in en {len(keysInEn)}')