|
3 | 3 |
|
4 | 4 | # ✍️Deepl translate cli
|
5 | 5 |
|
6 |
| - |
| 6 | + |
| 7 | + |
7 | 8 |
|
8 | 9 | ## Installation
|
9 | 10 |
|
| 11 | +### By [github release page](https://github.com/Omochice/deepl-translate-cli/releases) |
| 12 | + |
10 | 13 | 1. Download zipped file from [Releases](https://github.com/Omochice/deepl-translate-cli/releases).
|
11 | 14 |
|
12 | 15 | 2. Unzip downloaded file.
|
13 | 16 |
|
14 | 17 | 3. Move executable file into directory in PATH. (like `$HOME/.local/bin/`)
|
15 | 18 |
|
| 19 | +### By `go install` |
| 20 | +```sh |
| 21 | +go install github.com/Omochice/deepl-translate-cli@latest |
| 22 | +``` |
16 | 23 |
|
17 |
| -## Installation |
| 24 | +## Usage |
18 | 25 |
|
19 |
| -### By [github release page](https://github.com/Omochice/deepl-translate-cli/releases) |
20 | 26 | 1. Get deepl access token. See [here](https://www.deepl.com/docs-api).
|
21 | 27 |
|
22 | 28 | 2. Set access token as `DEEPL_TOKEN`
|
|
27 | 33 | export DEEPL_TOKEN <YOUR TOKEN>
|
28 | 34 | ```
|
29 | 35 |
|
30 |
| -3. Make configure file in `<user home directory>/.config/deepl-translate-cli/setting.json`. |
31 |
| - |
32 |
| - If run command without existing setting file, auto make it. |
| 36 | +3. On the first run, if `<user home directory>/.config/deepl-translate-cli/setting.json` does not exist, make it automatically. |
33 | 37 |
|
| 38 | + The format of setting file is below. |
| 39 | + ```json |
| 40 | + { |
| 41 | + "source_lang": "FILLIN", |
| 42 | + "target_lang": "FILLIN" |
| 43 | + } |
| 44 | + ``` |
34 | 45 | For write setting file, see [this page](https://www.deepl.com/docs-api/translating-text/request/).
|
35 | 46 |
|
36 |
| -### By `go install` |
37 |
| -```sh |
38 |
| -go install github.com/Omochice/deepl-translate-cli@latest |
39 |
| -``` |
40 | 47 |
|
41 |
| -## Usage |
42 | 48 |
|
43 |
| -- If you want translate from existing file. |
| 49 | +4. If file path is not specified, load text from STDIN. |
| 50 | + |
| 51 | + Currentry, only one path can be specified as argument. |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +- If you want to use `source_lang`/`target_lang` without using setting file, try to use `--source_lang (-s)` or `target_lang (-t)` argument. |
| 56 | + |
44 | 57 | ```console
|
45 |
| - $ deepl-translate-cli <text.txt> |
| 58 | + cat <text.txt> | deepl-translate-cli --source_lang ES --target_lang DE |
46 | 59 | ```
|
47 | 60 |
|
48 |
| -- If you want use stdin. |
49 |
| - - with pipe |
50 |
| - ```console |
51 |
| - $ echo "hello" | deepl-translate-cli --stdin |
52 |
| - ``` |
53 |
| - - with input |
54 |
| - ```console |
55 |
| - $ deepl-translate-cli --stdin |
56 |
| - <input text that wanted translate> <Enter> |
57 |
| - ``` |
| 61 | +- If you use Pro plan, use `--pro` flag to switch endpoint URL. |
| 62 | + |
| 63 | + _this feature is not tested because I use free plan._ |
| 64 | + |
| 65 | + ```console |
| 66 | + cat <text.txt> | deepl-translate-cli --pro |
| 67 | + ``` |
0 commit comments