goTrans

Command-line translation with multiple engines — fast CLI output, optional REST service, and pluggable backends.

Open Source — GPL-3.0 Full documentation

Support This Project

What is goTrans?

goTrans is a Go implementation inspired by translate-shell, but with more features with simple one binary for the terminal, an optional HTTP API, and swappable engines — without shipping a full browser stack.

Large inputs are split into ordered chunks so provider limits are less likely to break long documents. Output can be brief, verbose, or plain text only.

$ gotrans -t fr "Hello" Bonjour $ gotrans -t es "Good morning" ¡Buenos días! $ echo "Hello" | gotrans --text -t de Hallo

Why it exists

Terminal-first workflows still deserve solid translation tools: predictable flags, --text for automation, and a small HTTP surface when you need to integrate with other services.

🔧

Engines

Google (default), Bing, Yandex, Apertium, automatic selection, and a mock engine for tests.

🔀

Two modes

Run one-off translations in the terminal or start the REST API with an INI configuration file.

Automation-friendly

--text, stdin, -i / -o files, and :fr / -t language shortcuts for scripts.

📄

Chunking

Long input is split into ordered chunks so provider limits are less likely to break long documents.

CLI quick start

Translate

gotrans "Hello, world!"
gotrans :fr "Hello"
gotrans -e bing -t es "Good morning"
echo "pipe me" | gotrans --text -t de
gotrans -i document.txt -t fr
gotrans --text -i in.txt -o out.txt -t de

Service (example)

gotrans --service --init=service-scripts/gotrans.ini

The sample config often binds to localhost:8100. Adjust host, port, engine, and languages in your INI file.

REST API

With the service running, typical entrypoints include health, engines list, languages list, and translate.

GET /api/v1/health · POST /api/v1/translate
GET /api/v1/engines · GET /api/v1/languages

Health check

curl -fsS http://127.0.0.1:8100/api/v1/health

Translate (JSON)

curl -sS http://127.0.0.1:8100/api/v1/translate \
  -H 'content-type: application/json' \
  -d '{"text":"Hello, World!","source_lang":"auto","target_lang":"es","engine":"google"}'

Download

Prebuilt binaries (zip) for each platform.