-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
load_i18n.py
94 lines (89 loc) · 1.91 KB
/
load_i18n.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import csv
import json
import sys
KEYS = [
"city-bureau",
"meta-title",
"site-title",
"site-description",
"logo-alt",
"not-found-title",
"not-found-text",
"home",
"about",
"print",
"this-form",
"suggest-resource",
"suggest-resource-form-id",
"suggest-resource-intro",
"suggest-resource-intro-alt-form",
"feedback",
"feedback-form-id",
"feedback-intro",
"feedback-intro-alt-form",
"filter-title",
"intro-description",
"close",
"filter-description",
"filter-description-filters",
"filter-description-one-result",
"filter-description-no-results",
"flag-resource-label",
"flag-resource-success",
"notes-label",
"search-label",
"where-label",
"zip-placeholder",
"what-label",
"who-label",
"who-help",
"languages-label",
"show-filters",
"hide-filters",
"clear-filters",
"scroll-to-top",
"load-more-results",
"website",
"name-label",
"link-label",
"phone-label",
"regardless-of-status",
"last-updated",
"Money",
"Food",
"Housing",
"Health",
"Mental Health",
"Utilities",
"Legal Help",
"Families",
"Immigrants",
"LGBTQI",
"Business Owners",
"Students",
"Seniors",
"Hospitality Workers",
"Currently Incarcerated",
"Healthcare Workers",
"Domestic Workers",
"Creative Industry",
"English",
"Spanish",
"Arabic",
"Polish",
"Urdu",
"Vietnamese",
"Chinese",
"Tagalog",
"French",
"Hindi",
"Gujarati",
]
if __name__ == "__main__":
i18n_dict = {}
i18n_col = sys.argv[1]
rows = [r for r in csv.DictReader(sys.stdin)]
rows_dict = {r["ID"]: r[i18n_col] for r in rows if r.get("ID") and r.get(i18n_col)}
for key in KEYS:
i18n_dict[key] = rows_dict.get(key, "").strip()
sys.stdout.write(json.dumps(i18n_dict, indent=2, ensure_ascii=False))