Skip to content

Commit

Permalink
docs: 更新 README
Browse files Browse the repository at this point in the history
  • Loading branch information
wensonsmith committed Feb 7, 2020
1 parent 51d65f8 commit 04791cb
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 83 deletions.
118 changes: 35 additions & 83 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,55 @@ YoudaoTranslate | 有道翻译

## 一、 特性

### 1. 中英文互翻自动判断
#### 1. 中英文自动互翻

### 2. Hotkey 常用
#### 2. 快捷键支持
- 双击 `⌥ Alt` 可以翻译选中内容 (在 Hotkey 中设置)

- 快捷键双击 `` (可以在 Hotkey 中修改)可以翻译选中内容
- `⇧ Shift` + `Space` 可以直接唤出翻译输入框(在 Hotkey 中设置)

-`` + `space` 可以直接唤出翻译输入框,方便直接手动输入

### 3. 按住 ``+`↩︎` 即可发音 (使用系统自带的 say),这样不会关闭窗口。在音标上直接回车也可以播放发音并会关闭窗口。

按住 ``+`↩︎` 也能发音,调用有道语音 api,速度会慢一点;两者口音不一样。
#### 3. 英文发音
- `⌘ Command` + `↩︎ Enter` 本地发音(系统 `Say` 命令)
- `⌥ Alt` + `↩︎ Enter` 调用有道在线语音发音
- 在音标上回车发音并关闭窗口

![screenshot_3](screenshot/screenshot_3.png)

### 4. 在选项上`↩︎`回车可以复制翻译结果
#### 4. 在选项上 `↩︎ Enter` 回车复制翻译结果

### 5. 输入 `yd *` 可以查询最近的查询记录
#### 5. 输入 `yd *` 查询最近的翻译记录

![transalte_history](screenshot/translate_history.gif)


### 6. 翻译结果上按 `⇧(Shift)` 可以直接预览有道网页
#### 6. 翻译结果上按 `⇧ Shift` 直接预览有道网页

![screenshot_4](screenshot/screenshot_4.gif)

#### 7. 输入 `update` 检查更新 Workflow

![updae](screenshot/update.png)

## 二、下载使用
1. [GitHub Releases 直接下载](https://github.com/wensonsmith/YoudaoTranslate/releases)

下载解压后双击 `Youdao Translate.alfredworkflow` 导入即可使用。

1. 把 GitHub 项目中 src 目录内容下载到 `~/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows` 目录
可用的一键脚本:
## 二、开始使用

```bash
workflows="${HOME}/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/"
mkdir -p "${workflows}/YoudaoTranslate"
curl https://codeload.github.com/wensonsmith/YoudaoTranslate/tar.gz/master | \
tar -xz \
-C "${workflows}/YoudaoTranslate" \
--strip=2 YoudaoTranslate-master/src

```
#### 1. 下载导入使用
- [GitHub Releases 下载](https://github.com/wensonsmith/YoudaoTranslate/releases)
- [又拍云下载 v2.4.0](https://img.seekbetter.me/workflows/Youdao%20Translate.zip)




## 三、推荐设置

Hotkey 设置为 `Double ⌥`
下载解压后双击 `Youdao Translate.alfredworkflow` 导入即可使用。

#### 2. 使用源码

```shell
$ git clone https://github.com/wensonsmith/YoudaoTranslate.git /path/to/YoudaoTranslate
// 请注意这里是 Alfred 3 的路径
$ ln -s /path/to/YoudaoTranslate/src/ ~/Library/Application\ Support/Alfred\ 3/Alfred.alfredpreferences/workflows/YoudaoTranslate
```
以后只需要进入 `/path/to/YoudaoTranslate` 进行 `git pull` 即可更新

## 、 配置有道翻译 API KEYS
## 、 配置有道翻译

> 2017年9月3日更新
> 由于有道翻译 api 迁移到了有道智云,所以大家需要去[有道智云](http://ai.youdao.com/)进行注册然后创建应用了。步骤如下:
> 由于有道翻译 api 迁移到了有道智云,所以大家需要去[有道智云](http://ai.youdao.com/)进行注册然后创建应用了
1. 注册[有道智云](https://ai.youdao.com/)帐号

Expand All @@ -78,57 +69,18 @@ Hotkey 设置为 `Double ⌥`
5. 把变量填入 workflow 右上角的 [X] 点开后的配置框中


![var-config-step-1](screenshot/var-config-step-1.png)
![var-config-step-1](screenshot/var-config-step-1.jpg)

![var-config-step-2](screenshot/var-config-step-2.png)


## 四、Contributors

<a href="https://iwenson.com" target="_blank"><img src="https://avatars0.githubusercontent.com/u/2544185?s=60&v=4" /></a>
<a href="https://blog.zthxxx.me" target="_blank"><img src="https://avatars3.githubusercontent.com/u/15135943?s=60&v=4" /></a>

## 五、更新日志

- 2019年11月12日

- 修复有道 Api 更新造成的没有单词字典详细释义的问题
- 更新 Readme (修复文案按键、增加下载命令)

- 2019年8月27日

- 增加发音快捷键 (``)、优化单词复制过滤正则 (如 ~【数】【动】等)

- 2019年8月23日

- 使用 [alfred 自带 variables](https://www.alfredapp.com/help/workflows/advanced/variables/) 功能配置有道 API Keys

- 2019年8月22日

- 修复中译英时,每项选中 Enter 时直接复制内容为对应不同项翻译,而非固定第一项翻译

- 英译中时,固定第一项 选中内容 为英语原文,cmd + Enter 可以直接发音

- 2017年11月19日

- 优化发音,现在可以按住 ``+`↩︎` 进行发音 (#17

- 增加最近查询记录功能, 输入 `yd *` 可以列出最近查询的 9 个单词 (#10#16

- 2017年9月3日

- 更新 api 为有道智云(thanks @newle#12
- 优化发音,添加了线上发音
- 添加了双击翻译选中文字的热键

- 2017年1月13日

- 更新到Alfred3
- 支持选中音标进行发音
- 支持shift 预览Youdao网页

- 2016年3月24日

内置四个api key, 随机调用解决有道每小时1000次调用次数的限制。

### 六、 使用库和参考资料
## 五、 使用库和参考资料

- https://github.com/joetannenbaum/alfred-workflow
- https://www.alfredapp.com/help/workflows/inputs/
- https://www.alfredapp.com/help/workflows/advanced/variables/
- https://www.alfredapp.com/help/workflows/inputs/script-filter/json/
- https://www.alfredapp.com/help/workflows/
Binary file modified screenshot/screenshot_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshot/screenshot_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/update.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/var-config-step-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshot/var-config-step-1.png
Binary file not shown.

0 comments on commit 04791cb

Please sign in to comment.