Man¶
Name¶
trans - Translate text by google, bing, youdaozhiyun, haici, stardict, openai, large language model of local machine, etc at same time from CLI, GUI (GNU/Linux, Android, macOS and Windows), REPL, python, shell and vim.
Synopsis¶
trans [-h] [-V] [----print-completion {bash,zsh,tcsh}] [----print-setting [{config_file,history_file,dictionary_dirs,translators,languages,formats,clipper,speaker,dictionary_priorities}]] [-v] [-q] [----lsp] [----no-clipboard | ----clipboard] [----no-notification | ----notification] [----sleep-seconds SLEEP_SECONDS] [----config CONFIG] [----format {json,yaml,text}] [----translators TRANSLATORS] [----target-lang TARGET_LANG] [----source-lang SOURCE_LANG] [----options OPTIONS] [text ...]
Description¶
Translate text by google, bing, youdaozhiyun, haici, stardict, openai, large language model of local machine, etc at same time from CLI, GUI (GNU/Linux, Android, macOS and Windows), REPL, python, shell and vim.
Positional arguments¶
text¶
text needed to be translated, empty means entering REPL
Options¶
-h, ----help¶
show this help message and exit
-V, ----version¶
show program's version number and exit
----print-completion {bash,zsh,tcsh}¶
print shell completion script
----print-setting [{config_file,history_file,dictionary_dirs,translators,languages,formats,clipper,speaker,dictionary_priorities}]¶
print some setting
-v, ----verbose¶
increase logger level
-q, ----quiet¶
reduce logger level
----lsp¶
start language server
----no-clipboard¶
disable clipboard
----clipboard¶
enable clipboard (default)
----no-notification¶
disable notification
----notification¶
enable notification (default)
----sleep-seconds SLEEP_SECONDS¶
avoid checkout clipboard too frequently. default: 0.1
----config CONFIG¶
use a python file as config
----format {json,yaml,text}¶
output format for jq(1), yq(1). default: text
----translators TRANSLATORS¶
translate engines joined with ','. default: google
----target-lang TARGET_LANG¶
target languages. default: auto
----source-lang SOURCE_LANG¶
source languages. default: auto
----options OPTIONS¶
advanced usage, see https://translate- shell.readthedocs.io/en/latest/resources/config.html . default: []
Environment¶
LANG¶
When target_lang is "auto", will use LANG as target_lang. If LANG is empty, will use zh_CN.
XDG_CONFIG_HOME¶
See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
XDG_DATA_HOME¶
Same as above.
XDG_DATA_DIR¶
Same as above.
HOME¶
User's home directory.
SHELL¶
User's shell.
Files¶
.../config.py¶
Config file can be seen by:
trans ----print-setting config_file
.../history.txt¶
History file can be seen by:
trans ----print-setting history_file
.../stardict/dic/¶
stardict dictionary directory like STARDICT_DATA_DIR of sdcv(1) can be seen by:
trans ----print-setting stardict_dirs
Examples¶
clipper | trans¶
Translate clipboard. Clipper can be seen by
trans ----print-setting clipper
trans Free as in Freedom¶
Translate by CLI.
trans¶
Translate by REPL.