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

能否加个利用苹果自带词典功能? #187

Open
QuanchaoSong opened this issue May 18, 2021 · 5 comments
Open

能否加个利用苹果自带词典功能? #187

QuanchaoSong opened this issue May 18, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@QuanchaoSong
Copy link

我看现在的各个翻译源都是在线的,但是苹果系统本身是有翻译软件的,而且功能其实很强大。
Screen Shot 2021-05-18 at 5 49 47 PM
所以加个这个翻译源,把它作为默认,不挺好的吗?也避免了申请token的问题。当然,如果有人想用在线翻译,那就再配置token。

@QuanchaoSong QuanchaoSong added the enhancement New feature or request label May 18, 2021
@0xhyperdan
Copy link

苹果不会开放 API 的吧,不过可以调用 “聚焦搜索”,不知是否可行

@QuanchaoSong
Copy link
Author

苹果不会开放 API 的吧,不过可以调用 “聚焦搜索”,不知是否可行

有:https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/DictionaryServicesProgGuide/access/access.html#//apple_ref/doc/uid/TP40006152-CH5-SW1

我最近太忙了,好多事情要做。否则我直接就加了。

@yuhaowin
Copy link

苹果不会开放 API 的吧,不过可以调用 “聚焦搜索”,不知是否可行

有:https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/DictionaryServicesProgGuide/access/access.html#//apple_ref/doc/uid/TP40006152-CH5-SW1

我最近太忙了,好多事情要做。否则我直接就加了。

期待

@dingangui
Copy link

苹果不会开放 API 的吧,不过可以调用 “聚焦搜索”,不知是否可行

有:https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/DictionaryServicesProgGuide/access/access.html#//apple_ref/doc/uid/TP40006152-CH5-SW1

我最近太忙了,好多事情要做。否则我直接就加了。

期待,现在怎么样了呀

@yuhaowin
Copy link

#!/usr/bin/swift
import Foundation

if (CommandLine.argc < 2) {
print("Usage: dictionary word")
}else{
let argument = CommandLine.arguments[1]
let result = DCSCopyTextDefinition(nil, argument as CFString, CFRangeMake(0, argument.count))?.takeRetainedValue() as String?
print(result ?? "")
}

save this as dict.swift
swiftc dict.swift and run ./dict word

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants