Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

添加deepl翻译页面支持 #9

Merged
merged 4 commits into from
Dec 10, 2022
Merged

添加deepl翻译页面支持 #9

merged 4 commits into from
Dec 10, 2022

Conversation

duck123ducker
Copy link
Contributor

经过测试,chatgpt的翻译功能在某些方面比deepl还要准确,所以在deepl翻译页面添加翻译支持。

document.getElementsByClassName("lmt__textarea_container")[1].insertBefore(container, document.getElementsByClassName("lmt__translations_as_text")[0]);
}
let outlang=document.querySelectorAll("strong[data-testid='deepl-ui-tooltip-target']")[0].innerHTML
let question='翻译以下内容为'+outlang+',注意,你必须只返回翻译完成的文本,不允许返回其他任何无关内容:'+document.getElementById('source-dummydiv').innerHTML
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这句话可能可以优化为更短的语句,这样翻译等待时间会减少一些。

@bobz25
Copy link
Owner

bobz25 commented Dec 10, 2022

非常感谢你的贡献,我稍微改了下

let question = 'Translate the following paragraph into ' + outlang + ' and only '+ outlang +'\n\n' + document.getElementById('source-dummydiv').innerHTML

image

@bobz25 bobz25 merged commit 3ecf131 into bobz25:main Dec 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants