eeeXun/gtt

Google Translate TUI (Originally). Currently supports Apertium, Bing, ChatGPT, DeepL, DeepLX, Google, LibreTranslate, Reverso.

gtt – a terminal‑based translation UI

What it isgtt is a small command‑line program (written in Go) that lets you translate text from one language to another without leaving the terminal. It presents two panes – source and destination – and lets you pick from a handful of online translation services (Google, DeepL, Bing, Apertium, LibreTranslate, Reverso, and even ChatGPT‑based translation). The UI is driven by keyboard shortcuts and can also read the text aloud via the service’s text‑to‑speech endpoint.

Key capabilities

  • Supports many back‑ends; you can switch the provider on the fly.
  • Works with free APIs (Google, Bing, etc.) and with paid APIs that require a key (ChatGPT, DeepL, LibreTranslate, DeepLX). Keys are stored in a simple YAML config file.
  • Full‑screen TUI with configurable key bindings, colour themes, and optional copy‑to‑clipboard support (via xclip, wl‑clipboard or OSC 52).
  • Text‑to‑speech for both source and translated text, with play/stop controls.
  • Ability to swap source/destination languages, clear buffers, and copy selected or all text.

Installation

  • Pre‑built binaries for Linux and macOS are on the GitHub Releases page.
  • Arch Linux users can install the AUR package gtt-bin (yay -S gtt-bin).
  • Nix users can add gtt from nixpkgs-unstable or run nix run github:nixos/nixpkgs#gtt.
  • From source – either go install github.com/eeeXun/gtt@latest (adds the binary to $HOME/go/bin) or clone the repo and run go build.
  • Docker image eeexun/gtt is also provided (docker run -it eeexun/gtt:latest).

Configuration

  • Create $XDG_CONFIG_HOME/gtt/server.yaml (or $HOME/.config/gtt/server.yaml). Put API keys under api_key.<service>.value or point to a file containing the key.
  • For self‑hosted services like DeepLX or a private LibreTranslate instance, also set host.<service> with IP:port.
  • Optional keymap.yaml and theme.yaml let you remap shortcuts and change colours; they live in the same config directory.

Typical usage

# Translate English → Traditional Chinese using the defaults (Google)
gtt -src "English" -dst "Chinese (Traditional)"

Inside the UI you can:

  • <C-j> – translate the current source pane.
  • <C-s> – swap source and target languages.
  • <C-y> / <C-g> / <C-r> – copy selected, all source, or all destination text.
  • <C-o> / <C-p> – speak source or destination text.
  • <Esc> – open the pop‑out menu where you can change the provider, toggle transparency, etc.

Why it matters – While many developers use web‑based translators, gtt brings the same functionality to the terminal, which is handy for remote work, scripting, or any workflow that stays inside a shell. By supporting multiple back‑ends, it lets you compare quality or fall back to a free service when a paid API is unavailable.

Credits – The project re‑uses request logic from soimort/translate-shell, SimplyTranslate-Engines, and s0ftik3/reverso‑api, and draws UI inspiration from snsd0805/GoogleTranslate‑TUI and turk/free-google-translate.

Related

  • Project
  • Project
  • Project
  • Project
  • Project