You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
752 B

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)