/translate-workflow

Alfred workflow for translating text and making dictionary lookup 🕵️‍♂️

Primary LanguagePythonMIT LicenseMIT

translate-workflow

Alfred workflow for translating text and making dictionary lookup.

Built on top of Yandex Dictionary API and Yandex Translate API.

Features

  • Automatic translation from Russian to English and vice versa
  • Show synonyms and examples when translating a word
  • Correct spelling errors
  • Triggered both by t (eng) and е (rus) prefix
  • Global hotkey for translation of the selected text

Examples:

English to Russian Russian to English Spelling correction

Installation

Download Alfred workflow and open it

Configuration

Before start using this awesome workflow, you need to proceed with following steps:

To enable words translation:

  1. Obtain Dictionary API key. It's free
  2. Invoke Alfred and type tset <API_KEY>. Choose Save as Dictionary Api Key

To enable text translation:

  1. This step requires paid account on Yandex.Cloud. It's extremely cheap for amateur usage of Translate API though.
  2. Go to cloud console and create a service account with editor role.
  3. Generate API Token for this service account
  4. Invoke Alfred and type tset <Token>. Choose Save as Translate Api Token

Note: All your keys and tokens are stored in the OSX Keychain securely

Usage

Just type t <word> or t <phrase> and you'll get the input translated

Local development

make

It will create a translate-workflow folder in your default Alfred installation and add all required source files as symlinks.

Then just open Alfred on Workflows tab and you'll find it.

TODO:

  • Store desired languages in local settings
  • Auto detect source language
  • Cache API Keys to not access OSX Keychain every time
  • Cache API responses locally

Made with alfred-python-template

Icons made by photo3idea_studio from www.flaticon.com