Alfred Translate-It
An Alfred 5 workflow to translate text using OpenAI, DeepL, Google, Bing, Baidu and Youdao. This workflow also supports Universal Actions.
NOTE: OpenAI model 'text-davinci-003' is used in translation. (changed to gpt-3.5-turbo in v1.2)
Requirements
- Alfred PowerPack
- Python3 (system shipped Python3 not recommended, use other sources likes, Homebrew or pyenv installed Python3)
- Google translation is free and unlimited and requires no dependency, but may fail in mainland China.
- OpenAI Translation requires OpenAI API
- DeepL Translation requires DeepL API
- Other translation services requires translators library, install via:
# PYPI
pip install --upgrade translators
# Conda
conda install -c conda-forge translators
# Source
git clone https://github.com/UlionTse/translators.git
cd translators
python setup.py install
Usage
- Set up: target language, method of translation and your APIs. (Please check supported source language code from DeepL API docs and Translators library)
- Type anything after keyword
trans
to translate, it will auto-detect source language. - Then select any result and
⏎
to copy text to your clipboard ⌘ + ⏎
to view large text (useful if results are long)- For universal control, simple select any text and search for
translate
.
Thanks
- Open-source project UlionTse/translators, a library which aims to bring free, multiple, enjoyable translation to individuals and students in Python.
- Inspired by a discussion in a great macapp tisfeng/easydict
- py-googletrans
Some tranlation services (e.g. OpenAI, youdao) may be slow and delay the output.
If delay is a big issue, test the speed of each translation service and choose which ones to disable. (fixed in v 1.2)
For redering results speed, I am thinking about rendering the results in a sequence instead of showing them all at once, but I am not sure if Alfred will allow that.
Found a workaround in in v1.2 update.
Any suggestions are welcomed here!