docs » DeepLTranslate

Show a popup window with the translation of the currently selected text

The spoon uses the https://www.deepl.com translator page The selected text is copied into the source field.
The modal hotkey cmd+alt+ctrl+O replaces the selected text with the translation

Supported language codes are listed at https://www.deepl.com/translator

This is just an adaption of the Spoon PopupTranslateSelection written by Diego Zamboni Download: https://github.com/Hammerspoon/Spoons/raw/master/Spoons/DeepLTranslate.spoon.zip

API Overview

API Documentation

Variables

logger
Signature DeepLTranslate.logger
Type Variable
Description

Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.

Methods

bindHotkeys
Signature DeepLTranslate:bindHotkeys(mapping)
Type Method
Description

Binds hotkeys for DeepLTranslate

Parameters:

  • mapping - A table containing hotkey modifier/key details for the following items:
    • translate - translate the selected text without specifying source/destination languages (source defaults to auto-detect, destination defaults to your last choice or to English)

Sample value for mapping:

 {
    translate = { { "ctrl", "alt", "cmd" }, "E" },
 }
translatePopup
Signature DeepLTranslate:translatePopup(text)
Type Method
Description

Display a translation popup with the translation of the given text

Parameters:

  • text - string containing the text to translate

Returns:

  • The DeepLTranslate object
translateSelectionPopup
Signature DeepLTranslate:translateSelectionPopup()
Type Method
Description

Get the current selected text in the frontmost window and display a translation popup with the translation between the specified languages

Returns:

  • The DeepLTranslate object