feat: complete website internationalization and fix app store links dropdown
This commit is contained in:
39
scripts/clean_redundant_keys.py
Normal file
39
scripts/clean_redundant_keys.py
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
"""清理Localizable.xcstrings中的冗余本地化key"""
|
||||
|
||||
import json
|
||||
|
||||
# 需要删除的冗余key(这些是占位符或自动生成的无用条目)
|
||||
REDUNDANT_KEYS = [
|
||||
"%lld",
|
||||
"%lld%%",
|
||||
"•",
|
||||
"accessibility.aspectRatio %@" # 与 accessibility.aspectRatio 重复
|
||||
]
|
||||
|
||||
def main():
|
||||
xcstrings_path = "/Users/yuanjiantsui/projects/to-live-photo/to-live-photo/to-live-photo/Localizable.xcstrings"
|
||||
|
||||
# 读取现有文件
|
||||
with open(xcstrings_path, 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
|
||||
# 删除冗余key
|
||||
removed_count = 0
|
||||
for key in REDUNDANT_KEYS:
|
||||
if key in data["strings"]:
|
||||
del data["strings"][key]
|
||||
removed_count += 1
|
||||
print(f"✅ Removed: {key}")
|
||||
else:
|
||||
print(f"⚠️ Key '{key}' not found, skipping...")
|
||||
|
||||
# 写回文件(保持格式化)
|
||||
with open(xcstrings_path, 'w', encoding='utf-8') as f:
|
||||
json.dump(data, f, ensure_ascii=False, indent=2)
|
||||
|
||||
print(f"\n🎉 Successfully removed {removed_count} redundant keys!")
|
||||
print(f"📁 Updated: {xcstrings_path}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user