Google Translate TUI (Originally)
Supported Translator:
Apertium
,
Argos
,
Bing
,
ChatGPT
,
DeepL
(only free API),
Google
(default),
Reverso
ChatGPT and DeepL translations require API keys, which can be obtained from
OpenAI API keys and
DeepL API signup pages, respectively. Note
that only the free API is supported for DeepL currently. Once you have your
API key add it to $XDG_CONFIG_HOME/gtt/gtt.yaml
or
$HOME/.config/gtt/gtt.yaml
api_key:
chatgpt: CHATGPT_API_KEY # <- Replace with your API Key
deepl: DEEPL_API_KEY # <- Replace with your API Key
For Arch Linux, you need alsa-lib
.
For Ubuntu or Debian, you need libasound2-dev
.
For RedHat-based Linux, you need alsa-lib-devel
.
xclip
(optional) - for Linux/X11 to copy text.
wl-clipboard
(optional) - for Linux/Wayland to copy text.
Arch Linux (AUR)
yay -S gtt-bin
Nix ❄️ (nixpkgs-unstable)
add to your package list or run with:
nix-shell -p '(import <nixpkgs-unstable> {}).gtt' --run gtt
or with flakes enabled:
nix run github:nixos/nixpkgs#gtt
Binary file is available in Release Page for Linux and macOS on x86_64.
go install -ldflags="-s -w" github.com/eeeXun/gtt@latest
And make sure $HOME/go/bin
is in your $PATH
export PATH=$PATH:$HOME/go/bin
git clone https://github.com/eeeXun/gtt.git && cd gtt && go build -ldflags="-s -w -X main.version=$(git describe --tags)"
Run on Docker (Docker Hub)
docker run -it eeexun/gtt:latest
<C-c>
Exit program.
<Esc>
Toggle pop out window.
<C-j>
Translate from source to destination window.
<C-s>
Swap language.
<C-q>
Clear all text in source of translation window.
<C-y>
Copy selected text.
<C-g>
Copy all text in source of translation window.
<C-r>
Copy all text in destination of translation window.
<C-o>
Play text to speech on source of translation window.
<C-p>
Play text to speech on destination of translation window.
<C-x>
Stop playing text to speech.
<C-t>
Toggle transparent.
<C-\>
Toggle Definition/Example & Part of speech.
<Tab>
, <S-Tab>
Cycle through the pop out widget.
<1>
, <2>
, <3>
Switch pop out window.
You can overwrite the following key
exit
: Exit program.translate
: Translate from source to destination window.swap_language
: Swap language.clear
: Clear all text in source of translation window.copy_selected
: Copy selected text.copy_source
: Copy all text in source of translation window.copy_destination
: Copy all text in destination of translation window.tts_source
: Play text to speech on source of translation window.tts_destination
: Play text to speech on destination of translation window.stop_tts
: Stop playing text to speech.toggle_transparent
: Toggle transparent.toggle_below
: Toggle Definition/Example & Part of speech.
For key to combine with Ctrl
, the value can be C-Space
, C-\
, C-]
, C-^
, C-_
or C-a
to C-z
.
For key to combine with Alt
, the value can be A-Space
or A-
with the character you want.
Or you can use function key, the value can be F1
to F64
.
See the example in keymap.yaml file. This file should be located at $XDG_CONFIG_HOME/gtt/keymap.yaml
or $HOME/.config/gtt/keymap.yaml
.
You can create a theme with theme name. And you must provide the color of bg
, fg
, gray
, red
, green
, yellow
, blue
, purple
, cyan
, orange
.
And note that:
bg
is for background colorfg
is for foreground colorgray
is for selected coloryellow
is for label colororange
is for KeyMap menu colorpurple
is for button pressed color
See the example in theme.yaml file. This file should be located at $XDG_CONFIG_HOME/gtt/theme.yaml
or $HOME/.config/gtt/theme.yaml
.
You can pass -src
and -dst
in argument to set source and destination language.
gtt -src "English" -dst "Chinese (Traditional)"
See available languages on:
- Apertium Translate for
Apertium
- argosopentech/argos-translate for
Argos
- Bing language-support for
Bing
ChatGPT
is same asGoogle
. See Google Language support- DeepL API docs for
DeepL
- Google Language support for
Google
- Reverso Translation for
Reverso
soimort/translate-shell, SimplyTranslate-Engines, s0ftik3/reverso-api For request method.
snsd0805/GoogleTranslate-TUI For inspiration.
turk/free-google-translate For Google translate in Golang.