Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volcano Translate #636

Merged
merged 24 commits into from
Aug 22, 2024
Merged

Volcano Translate #636

merged 24 commits into from
Aug 22, 2024

Conversation

Jerry23011
Copy link
Collaborator

@Jerry23011 Jerry23011 commented Aug 11, 2024

Closes #255

@tisfeng
Copy link
Owner

tisfeng commented Aug 12, 2024

我先准备一下发布新版本,稍后再看。

@tisfeng
Copy link
Owner

tisfeng commented Aug 13, 2024

注意,EncryptedSecretKeys.plist 里面的 key 值都需要是加密后的值,读取时会直接解密,因此如果想在这里面添加值,需要先用 "123".encryptAES() 计算一下。

decryptedKeyValues[key] = value.decryptAES()

72839 45027

@tisfeng
Copy link
Owner

tisfeng commented Aug 13, 2024

我想了想,Volcano 这里我们还是不要添加默认的 key 了,直接让用户去自己申请 key 更好,如果没有填写,直接报错提示。

目前 Easydict 支持的免费翻译服务已经比较多了,一般有 DeepL, Google, Bing 这些够用了。

额外维护这些 key 比较麻烦,如果使用我们自己的 key,会占有自己的翻译额度,甚至被超支收费。

像目前腾讯翻译的 key,是我使用邮箱注册的小号申请的,但不是所有服务都支持小号,例如火山翻译就要求手机号,因此这种我们就不要内置 key,让用户自己去折腾好了。

@tisfeng
Copy link
Owner

tisfeng commented Aug 13, 2024

对于这种比较麻烦 API 签名问题,如果没有官方 SDK 或者 demo,我们可以直接去 GitHub 找现成的代码示例,例如直接搜代码 Action=TranslateText&Version,然后选择 Swift 语言,通常都能找到 🤣

https://github.com/search?q=Action%3DTranslateText%26Version%3D+language%3ASwift+&type=code

我没测过上面代码,你自己跑一下看看。

33274

@Jerry23011
Copy link
Collaborator Author

我们可以直接去 GitHub 找现成的代码示例,例如直接搜代码 Action=TranslateText&Version,然后选择 Swift 语言,通常都能找到 🤣

哈哈哈未曾设想的道路 😂

这两天有点事,有空了就看一下

@Jerry23011 Jerry23011 marked this pull request as ready for review August 18, 2024 04:45
@Jerry23011 Jerry23011 requested review from phlpsong, tisfeng, choykarl and AkaShark and removed request for phlpsong and tisfeng August 18, 2024 04:46
@Jerry23011
Copy link
Collaborator Author

现在就只有最后一个问题

在用户第一次输入 API key 后立刻点验证,会发现报错,我是在 translate func 里用 guard else 来处理的没有 API key 的情况,但是貌似 Defaults 不能在用户输入后立刻更新?

@tisfeng
Copy link
Owner

tisfeng commented Aug 19, 2024

你的写法不对,这里不应使用存储属性,应该使用计算属性 5a01ba0

@Jerry23011
Copy link
Collaborator Author

你的写法不对,这里不应使用存储属性,应该使用计算属性 5a01ba0

原来如此,感谢

@Jerry23011
Copy link
Collaborator Author

I canceled some of the workflows to save up CI minute

Copy link
Owner

@tisfeng tisfeng left a comment

Choose a reason for hiding this comment

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

Looks good.

@tisfeng tisfeng merged commit 070b237 into tisfeng:dev Aug 22, 2024
5 checks passed
@Jerry23011 Jerry23011 deleted the volcano-translate-swift branch August 23, 2024 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants