gitmyhub

translate-shell

Awk ★ 7.5k updated 1y ago

:speech_balloon: Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc.

A terminal tool that translates words and phrases between languages using Google Translate, Bing, or Yandex, no browser, no API key, just type and get results instantly.

AWKGNU awkBashsetup: easycomplexity 1/5

translate-shell is a command-line tool that lets you translate text between languages directly in your terminal, without opening a web browser. You type a word, phrase, or sentence alongside a target language code, and the translated result prints back immediately. It supports Google Translate, Bing Translator, and Yandex.Translate, among others.

The tool is written in AWK, a scripting language that comes pre-installed on most Unix-like systems. The only external requirement is GNU awk version 3.1 or newer, and no API key from any translation service is required. Installation is as simple as copying a single script file into a folder your system already knows about, though automated install scripts are also provided for Linux, macOS, and Windows.

Basic use looks like this: running "trs Weltschmerz" translates that German word to English on the spot. You can specify both the source and target language using short codes, so "trs {ja=fr}" sends Japanese text to French output. Multiple target languages work in a single command too, meaning one phrase can come back in Chinese, Japanese, Korean, and Thai all at once. The tool also accepts plain text files as input and streams the translation to the terminal as it arrives rather than waiting until the whole file is done.

There are a few practical limits worth knowing. Shell special characters such as exclamation marks need escaping when used inside double quotes, and square brackets should be kept out of the input text entirely. Very long lines can get cut off because the query travels as a URL, so keeping individual lines reasonably short avoids unexpected results.

For people who use the Vim text editor, the README includes a single-line configuration tip that maps a keyboard shortcut to look up and translate whatever word the cursor is resting on.

Where it fits