DEV Community

Cover image for Translate with alias

Posted on

Translate with alias


For those of us who do not know English and throw a lot of Google Translate...

  • Install translate-shell

brew install translate-shell

  • Add alias in .bash_profile or .zshrc

Note: The parameter: is the language, try to put different and obtain more results (example :en)

alias trad="trans :es "$(pbpaste)" -b | pbcopy"

Now when we want to translate what we have on the clipboard, we simply put trad in the terminal and we will have it copied

Update: I leave the file for Raycast, in case you want to use it with a combination of keys. I have based on this script (link)


# Dependency: requires translate-shell
# Install with Homebrew: `brew install translate-shell`

# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Traducir
# @raycast.mode silent
# @raycast.packageName Translate clipboard

# Documentation:
# josexs
# @raycast.authorURL
# @raycast.description Translate to ES and copy text of clipboard.

if ! command -v trans &> /dev/null; then
    echo "trans command is required (";
    exit 1;

trans :es "$(pbpaste)" -b | pbcopy

Enter fullscreen mode Exit fullscreen mode

See you with more tips!

Top comments (0)