explaingit

soimort/translate-shell

7,455AwkAudience · developerComplexity · 1/5Setup · easy

TLDR

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.

Mindmap

mindmap
  root((translate-shell))
    What it does
      Terminal translation
      Multi-language output
      File translation
    Sources
      Google Translate
      Bing Translator
      Yandex Translate
    Install
      Single script file
      Linux install script
      macOS install script
    Usage
      Word lookup
      Phrase translation
      Piped file input
    Integration
      Vim shortcut
      Shell scripting
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Translate a word or phrase into multiple languages at once directly in your terminal without opening a browser

USE CASE 2

Pipe a text file through the tool to translate its contents line by line

USE CASE 3

Add a Vim keyboard shortcut to instantly translate whatever word the cursor is resting on

Tech stack

AWKGNU awkBash

Getting it running

Difficulty · easy Time to first run · 5min

Requires GNU awk 3.1 or newer, no API key needed from any translation provider.

In plain English

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.

Copy-paste prompts

Prompt 1
How do I use translate-shell to translate a phrase from Japanese to French in my terminal?
Prompt 2
Show me how to translate a text file into Spanish and Chinese at the same time using translate-shell
Prompt 3
How do I set up a Vim shortcut using translate-shell to translate the word under my cursor?
Prompt 4
What shell escaping rules do I need to follow when using translate-shell with special characters like exclamation marks?
Open on GitHub → Explain another repo

← soimort on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.