-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathcheck-strings.py
More file actions
31 lines (27 loc) · 871 Bytes
/
Copy pathcheck-strings.py
File metadata and controls
31 lines (27 loc) · 871 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
import re
import os
BASE = "app/src/main/res/values/strings.xml"
LOCALES = [
"values-de", "values-es", "values-fi", "values-fr", "values-in",
"values-it", "values-ja", "values-nl", "values-pl", "values-pt",
"values-sv", "values-tr", "values-zh", "values-night",
]
def keys(path):
with open(path, encoding="utf-8") as f:
content = f.read()
return set(re.findall(r'name="([^"]+)"', content))
base_keys = keys(BASE)
print(f"Base keys: {len(base_keys)}")
for loc in LOCALES:
path = f"app/src/main/res/{loc}/strings.xml"
if not os.path.exists(path):
print(f"\n{loc}: FILE MISSING")
continue
loc_keys = keys(path)
missing = sorted(base_keys - loc_keys)
if missing:
print(f"\n{loc}: missing {len(missing)}")
for k in missing:
print(f" - {k}")
else:
print(f"{loc}: OK")