awesome-wm-widgets/translate-widget
Little Clover d41b54c168 correct valigh -> valign 2021-12-11 09:53:09 +08:00
..
README.MD fix #220 - update translate prompt README 2020-12-16 20:26:58 -05:00
demo.gif update demo gif 2018-01-21 16:19:36 -05:00
demo1.gif update demo gif 2018-01-21 16:19:36 -05:00
gnome-translate.svg [translate] fix #184 - move from yandex to watson 2020-11-09 10:57:52 -05:00
translate.lua correct valigh -> valign 2021-12-11 09:53:09 +08:00

README.MD

Translate Widget

This widget allows quickly translate words or phrases without opening a browser - just using Awesome. To provide direction of the translation add the 2 letters code of the source and target languages at the end of the phrase, for example hello enfr will translate hello from English to French. This widget is based on Watson Language Translator from IBM.

demo

Controls

  • Mod4 + c - opens a translate prompt;
  • left click on the popup widget - copies the translation to the clipboard and closes widget;
  • right click on the popup widget - copies text to translate to the clipboard and closes widget.

Installation

  1. Clone repo under ~/.config/awesome/

  2. Create an IBM Cloud API key at cloud.ibm.com/iam/apikeys

  3. Copy a service URL by going to resource list, then under "Services" select "Language Translator" option, and then copy URL from the "Credentials" section

  4. Require widget in rc.lua:

    local translate = require("awesome-wm-widgets.translate-widget.translate")
    
  5. Add a shortcut to run translate prompt:

    awful.key({ modkey }, "c", function() 
        translate.launch{api_key = '<api-key>', url = 'url'} 
    end, { description = "run translate prompt", group = "launcher" })