forked from rmcauley/rainwave
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlang_master_audit.py
More file actions
37 lines (32 loc) · 797 Bytes
/
lang_master_audit.py
File metadata and controls
37 lines (32 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os
import api.locale
api.locale.load_translations()
to_pop = []
for k, v in api.locale.master.iteritems():
found = False
for root, subdirs, files in os.walk(os.path.join("static", "js4")):
for filename in files:
if filename.endswith(".js"):
f = open(os.path.join(root, filename))
c = f.read()
if c.find("$l(\"%s\")" % k) >= 0:
found = True
break
f.close()
if found == True:
continue
if not found:
to_pop.append(k)
# for k in to_pop:
# print k
f = open(os.path.join("lang", "en_MASTER.json"))
out = open("out.json", "w")
for line in f:
if to_pop.count(line.strip().split(" ", 1)[0].strip('"')) == 0:
out.write(line)
elif len(line.strip()) == 0:
out.write(line)
elif line.find("__comment__") >= 0:
out.write(line)
f.close()
out.close()