awesome-wm-widgets/translate-widget/README.MD

31 lines
1.2 KiB
Plaintext
Raw Normal View History

2017-12-27 19:59:34 +01:00
# Translate Widget
2018-01-21 03:38:32 +01:00
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 [Yandex.Translate API](https://tech.yandex.com/translate/).
2018-01-20 20:12:40 +01:00
![demo](./demo.gif)
2018-01-21 03:38:32 +01:00
## Controls
- <kbd>Mod4</kbd> + <kbd>c</kbd> - 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.
2017-12-27 19:59:34 +01:00
## Installation
2018-01-21 03:42:28 +01:00
1. Clone repo under **~/.config/awesome/**
1. Get an [API key](https://translate.yandex.com/developers/keys)
2018-01-21 22:27:19 +01:00
1. Require widget in **rc.lua**:
2018-01-21 03:24:07 +01:00
```lua
local translate = require("awesome-wm-widgets.translate-widget.translate")
```
2018-01-21 22:29:13 +01:00
1. Add a shortcut to run translate prompt:
2018-01-21 03:24:07 +01:00
```lua
2019-09-02 04:08:02 +02:00
awful.key({ modkey }, "c",
function() translate.show_translate_prompt('<api-key>') end,
2019-09-02 04:08:02 +02:00
{ description = "run translate prompt", group = "launcher" }),
2018-01-21 03:24:07 +01:00
```
2018-01-21 03:42:28 +01:00