# coc-translator
Translation extension for [coc.nvim](https://github.com/neoclide/coc.nvim).
![publish](https://github.com/voldikss/coc-translator/workflows/publish/badge.svg)
[![npm version](https://badge.fury.io/js/coc-translator.svg)](https://badge.fury.io/js/coc-translator)
![](https://user-images.githubusercontent.com/20282795/103474126-b8e31b00-4ddb-11eb-916b-2e2d7b2b29e0.png)
## Install
```
:CocInstall coc-translator
```
## Features
- Multiple translator engines
- Translation history(CocList)
- Proxy support(see [coc.nvim doc](https://github.com/neoclide/coc.nvim/blob/master/doc/coc.txt#L113-L119))
## Configuration
<!-- Generated by 'yarn run bulid:doc', please don't edit it directly -->
<!-- prettier-ignore-start -->
<strong>Properties</strong>
<details>
<summary><code>translator.toLang</code>: Target language type, input it if it's not fould in the candidates.</summary>
Type: <pre><code>(('zh_CN' | 'zh_TW' | 'en' | 'fr' | 'de' | 'ja' | 'ko' | 'ru') | string) & string</code></pre>Default: <pre><code>"zh_CN"</code></pre>
</details>
<details>
<summary><code>translator.engines</code>: .</summary>
Type: <pre><code>string[]</code></pre>Default: <pre><code>[
"bing",
"google",
"youdao",
"haici"
]</code></pre>
</details>
<details>
<summary><code>translator.proxy</code>: Address of proxy, i.e., `socks://127.0.0.1:1081`.</summary>
Type: <pre><code>string</code></pre>
</details>
<details>
<summary><code>translator.enableHover</code>: Translate when mouse hover.</summary>
Type: <pre><code>boolean</code></pre>Default: <pre><code>false</code></pre>
</details>
<details>
<summary><code>translator.window.enableBorder</code>: .</summary>
Type: <pre><code>boolean</code></pre>Default: <pre><code>true</code></pre>
</details>
<details>
<summary><code>translator.window.maxWidth</code>: .</summary>
Type: <pre><code>number</code></pre>Default: <pre><code>80</code></pre>
</details>
<details>
<summary><code>translator.window.maxHeight</code>: .</summary>
Type: <pre><code>number</code></pre>Default: <pre><code>20</code></pre>
</details>
<!-- prettier-ignore-end -->
## Keymaps
Example
```vim
" NOTE: do NOT use `nore` mappings
" popup
nmap <Leader>t <Plug>(coc-translator-p)
vmap <Leader>t <Plug>(coc-translator-pv)
" echo
nmap <Leader>e <Plug>(coc-translator-e)
vmap <Leader>e <Plug>(coc-translator-ev)
" replace
nmap <Leader>r <Plug>(coc-translator-r)
vmap <Leader>r <Plug>(coc-translator-rv)
```
## Commands
! Commands were not supported yet
## Work with translation lists
run `:CocList translation` to open the translation list.
- Filter your translation items and perform operations via `<Tab>`
- Use operation `delete` to delete the translation item under the cursor
- Use operation `yank` to yank ...
- Use operation `jumpto` to jump to the location where you've performed translating
- Use operation `append` to append the word to the end of cursor position
- Use operation `pretend` to pretend ...
[1]: https://github.com/voldikss/vim-translator/wiki/bing-api
[2]: https://github.com/voldikss/vim-translator/wiki/Ciba-api
[3]: https://github.com/voldikss/vim-translator/wiki/Google-api
[4]: https://github.com/voldikss/vim-translator/wiki/Youdao-api
## License
MIT