intellism / vscode-comment-translate

vscode 注释翻译插件, 不干扰正常代码,方便快速阅读源码。
https://marketplace.visualstudio.com/items?itemName=intellsmi.comment-translate
MIT License
481 stars 75 forks source link

我增加了DeepLX的翻译服务 #224

Open zj1016 opened 1 month ago

zj1016 commented 1 month ago

Deeplx Comment Translate

intellism commented 1 month ago

👍🏻

lc6464 commented 1 week ago

建议添加在 vscode 扩展市场中添加 translateSource 的 Tag,不然难以找到,我也是翻 Issues 才翻到的。

zj1016 commented 1 week ago

这个插件能正常工作吗  有什么好的建议改进吗 

---原始邮件--- 发件人: @.> 发送时间: 2024年7月17日(周三) 晚上8:59 收件人: @.>; 抄送: @.**@.>; 主题: Re: [intellism/vscode-comment-translate] 我增加了DeepLX的翻译服务 (Issue #224)

建议添加在 vscode 扩展市场中添加 translateSource 的 Tag,不然难以找到,我也是翻 Issues 才翻到的。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

lc6464 commented 1 week ago

从半小时短暂的为了体验而进行的体验的效果来看,工作是正常的。

至于建议:

  1. 可以加入自动上下文功能,比如说加上文本前后的其他注释、代码之类的内容,而不是固定一个上下文。
  2. 建议 deeplxTranslate.contents 默认为空
  3. 建议加入跟随 commentTranslate.targetLanguage 作为目标语言自动判断源语言类型的功能
zj1016 commented 6 days ago

我提交了最新版本 1.增加了 TranslareSource 关键字为Tag。 2.contents改为默认为空(自动上下文功能懒得改了) 3.翻译语言及目标语言改为跟随commentTranslate.targetLanguage。


发件人: @. @.> 代表 LC @.> 发送时间: 2024年7月17日 06:43 收件人: intellism/vscode-comment-translate @.> 抄送: ZJ @.>; Author @.> 主题: Re: [intellism/vscode-comment-translate] 我增加了DeepLX的翻译服务 (Issue #224)

从半小时短暂的为了体验而进行的体验的效果来看,工作是正常的。

至于建议:

  1. 可以加入自动上下文功能,比如说加上文本前后的其他注释、代码之类的内容,而不是固定一个上下文。
  2. 建议 deeplxTranslate.contents 默认为空
  3. 建议加入跟随 commentTranslate.targetLanguage 作为目标语言和自动判断源语言类型的功能

― Reply to this email directly, view it on GitHubhttps://github.com/intellism/vscode-comment-translate/issues/224#issuecomment-2233362026, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOE5ITOVYP3LUH47GHQB6DLZMZYHZAVCNFSM6AAAAABJWGOWAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZTGM3DEMBSGY. You are receiving this because you authored the thread.Message ID: @.***>

zj1016 commented 6 days ago

我尝试 :“跟随 commentTranslate.targetLanguage 作为目标语言和自动判断源语言类型”

但是发现 targetLanguage的枚举值与 deeplx API的参数不适配 比如 ZH_CN 在deeplx里必须用ZH

如果要多语言适配要针对每个语言进行判断赋值 所以我又恢复了 这两个选项 让用户自定义语言


发件人: @. @.> 代表 LC @.> 发送时间: 2024年7月17日 06:43 收件人: intellism/vscode-comment-translate @.> 抄送: ZJ @.>; Author @.> 主题: Re: [intellism/vscode-comment-translate] 我增加了DeepLX的翻译服务 (Issue #224)

从半小时短暂的为了体验而进行的体验的效果来看,工作是正常的。

至于建议:

  1. 可以加入自动上下文功能,比如说加上文本前后的其他注释、代码之类的内容,而不是固定一个上下文。
  2. 建议 deeplxTranslate.contents 默认为空
  3. 建议加入跟随 commentTranslate.targetLanguage 作为目标语言和自动判断源语言类型的功能

― Reply to this email directly, view it on GitHubhttps://github.com/intellism/vscode-comment-translate/issues/224#issuecomment-2233362026, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOE5ITOVYP3LUH47GHQB6DLZMZYHZAVCNFSM6AAAAABJWGOWAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZTGM3DEMBSGY. You are receiving this because you authored the thread.Message ID: @.***>

intellism commented 3 days ago

我尝试 :“跟随 commentTranslate.targetLanguage 作为目标语言和自动判断源语言类型” 但是发现 targetLanguage的枚举值与 deeplx API的参数不适配 比如 ZH_CN 在deeplx里必须用ZH 如果要多语言适配要针对每个语言进行判断赋值 所以我又恢复了 这两个选项 让用户自定义语言 ____ 发件人: @. @.> 代表 LC @.> 发送时间: 2024年7月17日 06:43 收件人: intellism/vscode-comment-translate @.> 抄送: ZJ @.>; Author @.> 主题: Re: [intellism/vscode-comment-translate] 我增加了DeepLX的翻译服务 (Issue #224) 从半小时短暂的为了体验而进行的体验的效果来看,工作是正常的。 至于建议: 1. 可以加入自动上下文功能,比如说加上文本前后的其他注释、代码之类的内容,而不是固定一个上下文。 2. 建议 deeplxTranslate.contents 默认为空 3. 建议加入跟随 commentTranslate.targetLanguage 作为目标语言和自动判断源语言类型的功能 ― Reply to this email directly, view it on GitHub<#224 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOE5ITOVYP3LUH47GHQB6DLZMZYHZAVCNFSM6AAAAABJWGOWAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZTGM3DEMBSGY. You are receiving this because you authored the thread.Message ID: @.***>

comment translate有一套默认值,是采用google的标准。。你可以在你翻译源插件里做一个映射。 可以参考 https://github.com/intellism/deepl-translate/blob/master/src/deepLTranslate.ts#L11