-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_strings.py
More file actions
33 lines (28 loc) · 853 Bytes
/
Copy pathupdate_strings.py
File metadata and controls
33 lines (28 loc) · 853 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
import json
file_path = "/Users/corlin/2026/Floraboard-ios/Floreboard/Localizable.xcstrings"
with open(file_path, "r") as f:
data = json.load(f)
new_keys = {
"inventory.row.used": {"en": "Used", "zh-Hans": "已消耗"}
}
for key, values in new_keys.items():
data["strings"][key] = {
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": values["en"]
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": values["zh-Hans"]
}
}
}
}
with open(file_path, "w") as f:
json.dump(data, f, indent=2, ensure_ascii=False)
print("Updated Localizable.xcstrings")