mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-12-26 12:41:56 +03:00
Merge pull request #1634 from xwxtwd/main
Change uses of whitelist to allowlist in translate_readme.py.
This commit is contained in:
commit
c2f2927148
@ -18,12 +18,12 @@ Don't translate or change inline code examples.
|
||||
```md
|
||||
"""
|
||||
keep_note = "Keep this: [!Note] as [!Note].\n"
|
||||
blacklist = [
|
||||
blocklist = [
|
||||
'## ©️ Copyright',
|
||||
'## 🚀 Providers and Models',
|
||||
'## 🔗 Related GPT4Free Projects'
|
||||
]
|
||||
whitelist = [
|
||||
allowlist = [
|
||||
"### Other",
|
||||
"### Models"
|
||||
]
|
||||
@ -52,15 +52,15 @@ async def translate(text):
|
||||
return result
|
||||
|
||||
async def translate_part(part, i):
|
||||
blacklisted = False
|
||||
for headline in blacklist:
|
||||
blocklisted = False
|
||||
for headline in blocklist:
|
||||
if headline in part:
|
||||
blacklisted = True
|
||||
if blacklisted:
|
||||
blocklisted = True
|
||||
if blocklisted:
|
||||
lines = part.split('\n')
|
||||
lines[0] = await translate(lines[0])
|
||||
part = '\n'.join(lines)
|
||||
for trans in whitelist:
|
||||
for trans in allowlist:
|
||||
if trans in part:
|
||||
part = part.replace(trans, await translate(trans))
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user