-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_fix.py
More file actions
66 lines (53 loc) · 1.96 KB
/
test_fix.py
File metadata and controls
66 lines (53 loc) · 1.96 KB
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
#!/usr/bin/env python3
"""
测试修复是否有效
"""
import os
def test_translation_files():
"""测试翻译文件"""
i18n_dir = '/Users/yangshengpeng/Desktop/openAI/clawdbot/ui/src/ui/i18n'
print("🔍 测试翻译文件完整性...\n")
# 检查en.ts
en_path = os.path.join(i18n_dir, 'en.ts')
with open(en_path, 'r', encoding='utf-8') as f:
en_content = f.read()
# 检查zh-CN.ts
zh_path = os.path.join(i18n_dir, 'zh-CN.ts')
with open(zh_path, 'r', encoding='utf-8') as f:
zh_content = f.read()
# 检查types.ts
types_path = os.path.join(i18n_dir, 'types.ts')
with open(types_path, 'r', encoding='utf-8') as f:
types_content = f.read()
# 检查completed是否在所有文件中
checks = [
("en.ts", "completed:", en_content),
("zh-CN.ts", "completed:", zh_content),
("types.ts", "completed: string;", types_content),
]
all_ok = True
for filename, check_str, content in checks:
if check_str in content:
print(f"✅ {filename}: 包含 '{check_str}'")
else:
print(f"❌ {filename}: 缺少 '{check_str}'")
all_ok = False
# 检查tool-cards.ts是否修复
tool_cards_path = '/Users/yangshengpeng/Desktop/openAI/clawdbot/ui/src/ui/chat/tool-cards.ts'
with open(tool_cards_path, 'r', encoding='utf-8') as f:
tool_cards_content = f.read()
if 't("common.completed")' in tool_cards_content:
print(f"\n✅ tool-cards.ts: 已使用翻译函数")
elif 'Completed' in tool_cards_content:
print(f"\n❌ tool-cards.ts: 仍有硬编码 'Completed'")
all_ok = False
else:
print(f"\n⚠️ tool-cards.ts: 未找到相关文本")
return all_ok
def main():
if test_translation_files():
print("\n🎉 所有测试通过!")
else:
print("\n❌ 测试失败,请检查修复。")
if __name__ == '__main__':
main()