Shortcut key to translate the selected string into English and replace it. The program itself is very simple.
You can find more details here.
Open Automator.app
Library > Utilities > Run Shell Scripts
Change shell to Python, write contents of app.py and save as hoge.workflow
Open keyboard
Shortcut tab > Services
find hoge
and assign the key combination. Here I assigned cmd + '
for translation
. (Recommended)
Select the part you want to translate into English and press cmd + '
.
Shortcuts to translate English into Japanese can also be made by simply replacing 'ja' and 'en'.