Skip to main content

Plugin: DeepL Translation

A simple plugin that gives you an automatic translation of a post from any language into any other language via DeepL. The translation is displayed in a new tab.

Installation

Go to Settings -> Plugins -> Install Plugins and paste the following code into the text box:

### {
  name: "DeepL Translate"
  version: "1.1.1"
  author:  "volpeon"
  description: "Translate posts from any language into any other language with DeepL"
  permission: []
  config: {
    target_language: {
      type: "string"
      label: "Target language to translate into (ISO 639-1 language code)"
      default: "en"
    }
  }
}


@translate(note) {
  Plugin:open_url(Arr:join(["https://www.deepl.com/translator#auto/" Plugin:config.target_language "/" Str:replace(Str:replace(note.text "/" "\%2F") "#" "%23")]))
  note
}

Plugin:register_note_action("Translate" translate)

The target langauge is English by default and can be changed in the plugin's configuration. The setting requires an ISO-639-1 language code (such as "en" or "de"). Wikipedia has a list of all codes: https://de.wikipedia.org/wiki/Liste_der_ISO-639-1-Codes

Changelog

  • 1.1.1: Fixed handling of hashtags in posts
  • 1.1.0: Added setting to configure own target language
  • 1.0.0: Initial release

Source: https://mk.vulpes.one/@volpeon/pages/1628327651656
Author: @volpeon