This repo serves as a tool to streamline the creation of langauge-learning flashcards in Anki. The program allows translation between English and a target langauge and the creation of Anki flashcards with text-to-speech audio. Usage of this script requires personal attainment of DeepL and Azure API keys for translation and text-to-speech services, respectively.
-
Make sure you have the AnkiConnect addon installed in Anki. This allows external programs to add/edit/remove cards in Anki.
-
Attain API keys for DeepL and Azure TTS. Follow this link to create a DeepL account and attain a key. The process for an Azure API key is a bit more convoluted. Follow this link and create a free account. As of writing this, a free account with Azure will get you 500,000 characters per month.
-
Open the Setup.json file and paste your API keys in their respective field. Also, input the path for your Anki "collection.media" folder.
-
Next, run the following to install python dependencies.
pip install -r requirements.txt
- Finally, you can run the following to start the GUI. I like to use AutoHotKey to bind the program to a keyboard shortcut for easy access.
python TranslatorForAnki.pyw
Anki must be running for the script to function!
The program will detect which langauge to translate to/from based on the text box the cursor is active in. If the course is active in the "English" text box, it will translate to the target language, and vise versa.
