返回提交历史
Modified
etc/tool/translate_readme.py
+7
-7
XFEstudio/gpt4free
Change uses of whitelist to allowlist in translate_readme.py. Change uses of blacklist to blocklist in translate_readme.py. Change uses of blacklisted to blocklisted in translate_readme.py.
5b454783
代码差异
1 个文件
+7
-7
@@ -18,12 +18,12 @@ Don't translate or change inline code examples.
18
18
```md
19
19
"""
20
20
keep_note = "Keep this: [!Note] as [!Note].\n"
21
blacklist = [
21
blocklist = [
22
22
'## ©️ Copyright',
23
23
'## 🚀 Providers and Models',
24
24
'## 🔗 Related GPT4Free Projects'
25
25
]
26
whitelist = [
26
allowlist = [
27
27
"### Other",
28
28
"### Models"
29
29
]
@@ -52,15 +52,15 @@ async def translate(text):
52
52
return result
53
53
54
54
async def translate_part(part, i):
55
blacklisted = False
56
for headline in blacklist:
55
blocklisted = False
56
for headline in blocklist:
57
57
if headline in part:
58
blacklisted = True
59
if blacklisted:
58
blocklisted = True
59
if blocklisted:
60
60
lines = part.split('\n')
61
61
lines[0] = await translate(lines[0])
62
62
part = '\n'.join(lines)
63
for trans in whitelist:
63
for trans in allowlist:
64
64
if trans in part:
65
65
part = part.replace(trans, await translate(trans))
66
66
else: