diff --git a/find_missing_i18n_strings.py b/find_missing_i18n_strings.py new file mode 100644 index 0000000..8656185 --- /dev/null +++ b/find_missing_i18n_strings.py @@ -0,0 +1,26 @@ +import re +import os +import json + +en = json.load(open('i18n/en.json')) +error = False +dict = {} + +rootdir=('.') +for folder, dirs, files in os.walk(rootdir): + for file in files: + if file.endswith('.html'): + fullpath = os.path.join(folder, file) + with open(fullpath, 'r') as f: + for line in f: + m = re.match('.*{{\s+?i18n\s+?(?:"|`)(.*)(?:"|`)\s+?}}', line) + if m: + string = m.group(1) + if string not in en: + error = True + print(f'TRANSLATION ERROR: {string}') + dict[string] = string + +if error: + print(json.dumps(dict, indent=3)) + exit(1)