33 2
Contact Author Sign in to rate

Google Translate

0.30MB. Updated 2021-09-13. Only supports Anki 2.1.x.
The author has shared 35 other item(s).

Description

An Anki add-on to translate text with Google Translate - https://translate.google.com How to Use - From the Editor Click on - From the Browser 1. Select a few cards in the card browser 2. Open the Edit menu and then Google Translate Extra Fields - Romanization - Target Romanization - Definitions - Examples - Alternative Translations Related Projects RFB9000 by lovac42 - https://github.com/lovac42/RFB9000 Changelog 2020-07-05 First upload 2020-08-23 Translate cloze tags as <c> tags 2020-10-20 Add option to translate HTML 2020-10-21 Add option to overwrite the target field 2020-10-26 Ignore attributes while translating HTML 2020-10-26 Ignore notes with the empty source field 2020-10-26 Keep cloze deletions numbers 2020-11-06 Fix AssertionError by splitting on ~ and 〜 2020-11-23 Add romanization 2021-02-14 Fix AssertionError by ignoring " " between ~ 2021-03-18 Add definitions 2021-03-23 Autosave while sleeping 2021-04-03 The progress dialog is cancellable 2021-04-03 Translate from the editor screen 2021-04-03 Add examples 2021-04-13 Ignore HTML to get word definitions 2021-05-23 Add alternative translations 2021-05-23 Fix alternative translations (thanks to @deividaspetraitis) 2021-08-07 Fix missing word definitions 2021-08-27 Translate from a field to itself 2021-08-27 Add target romanization 2021-08-27 Target Field can be empty 2021-08-27 Show a tooltip message if no fields were updated in the editor 2021-08-28 Fix object of type 'NoneType' has no len() 2021-08-28 Get definitions and examples using the translated text (#12) 2021-09-13 Toggle visibility of meanings for alternative translations (#13) 2021-09-13 Experimental support for on-the-fly generation (#14) 2021-09-13 Hide extra fields and options from UI using the context menu Additional Information It works more or less similar to https://github.com/ssut/py-googletrans by relying on the outdated Google Translate Ajax API to translate text. The add-on tries to make fewer requests if possible and sleeps for 30 seconds every now and then. Downloading definitions or examples for multiple notes at once (using the card browser) is a slow process, every request will take about 4-8 seconds. Credits & Acknowledgements The add-on depends on py-googletrans to fetch alternative translations - https://github.com/ssut/py-googletrans A note of warning Use at your own risk. Translating a lot of text for a continuous period of time might result in the IP ban from Google, maybe for a few hours. Other Add-ons DeepL Translator - https://ankiweb.net/shared/info/972129549 Nickolay Nonard <kelciour@gmail.com>

Download

As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:

1536291224

If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

All Anki 2.1.x Add-Ons Contact Author

Reviews

on 1634750236
great add on
on 1633133822
love it!
Add the function of pronunciation will be perfect.
on 1632845672
Great add-on thanks.

I created a bunch of cards without a translation, then realised a translation would have been helpful, and this add-on saved me a boatload of work. Thanks!
on 1630835771
Elegant and solves a common challenge pattern, perfect to translate to unsupported DeepL languages.
Kudos and thanks, used it to convert decks for recent immigrants in my language classes.
on 1629738547
it's the BEST!
on 1629139365
Easy to use and very convenient!
on 1626938722
Thank you!
on 1625417966
Great add on but the definition section does not work.
To be fair, usually you do not get the definition even when using the real google translate so all in all a great add on !
Highly recommended
on 1622283226
Useful addon, but does not fetch definition of particular words. Or it sometimes gives incomplete information on definitions.
on 1621939423
Exactly what I've been looking for, a keyboard shortcut would be superb idk if its possible with Anki
on 1620759190
Superbe travail.

Merci beaucoup.
on 1619938807
The idea of the software is good, but mine is giving this error to 80% of the cards:

Error:

Traceback (most recent call last):
File "C:\Users\Estudos\AppData\Roaming\Anki2\addons21\1536291224\__init__.py", line 250, in accept
r.raise_for_status()
File "requests\models.py", line 940, in raise_for_status
requests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url: https://translate.googleapis.com/translate_a/single?client=gtx&sl=it&tl=pt&dt=t&q=Tu%20hai%20accettato%20il%20suo%20invito%3F

Maybe you know how to solve it.
Comment from author
It's unlikely to be fixed. The web version of Google Translate is rate limited and the add-on isn't optimized to translate hundreds or thousands of notes for a continuous period of time. Until something is done to make this error, "429 Client Error: Too Many Requests", to be less frequent and be able to translate more text, a simple workaround is to wait for a few hours.

Another possible option is to add support for the official Google Cloud Translation API. It has a free tier, the first 500,000 characters are free per month.
on 1619055066
This addon is very awesome. However, i have encountered some problem with it, when i want to translate from german to english

Error:

Traceback (most recent call last):
File "C:\Users\Admin\AppData\Roaming\Anki2\addons21\1536291224\__init__.py", line 250, in accept
r.raise_for_status()
File "requests\models.py", line 943, in raise_for_status
requests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url: https://translate.googleapis.com/translate_a/single?client=gtx&sl=de&tl=en&dt=t&q=Wie%20%3Ci%3Ehei%C3%9Fen%3C/i%3E%20die%20%3Cb%20style%3D%22%22%3EBasen%3C/b%3E%20von%20%3Ci%20style%3D%22%22%3EDNA%3C/i%3E%20bzw.%20%3Ci%20style%3D%22%22%3ERNA%3C/i%3E%3F%3Cdiv%3E%3Cbr%3E%3C/div%3E%3Cdiv%3E%E2%80%A2%20%3Ci%3EDNA%3C/i%3E%3A%20%3Cc1%3ECytosin%20%28C%29%20%7C%20Thymin%20%28T%29%20%7C%20Adenin%20%28A%29%20%7C%20Guanin%20%28G%29%3C/c%3E%3C/div%3E%3Cdiv%3E%E2%80%A2%20%3Ci%3ERNA%3C/i%3E%3A%20%3Cc1%3EUracil%20%28U%29%20%28anstelle%20von%20Thymin%29%3C/c%3E%3C/div%3E
on 1618733269
Could it be possible that source field and target field are the same ?
on 1618575569
Thanks for this amazing add-on,
and i wish if you could make one for DeepL, as it's more accurate translator..
on 1618297730
A better explanation how it works would be appreciate. A single screenshot without comments is not enough.
Comment from author
It's been a while and I'm going to close the issue on GitHub. If something isn't clear, please create a new issue on GitHub.
If the add-on is working for you, please update the feedback. Thank you.
---
Here's a quick video how to use the add-on to translate a field or a batch of fields - https://imgur.com/a/VMpCixr
on 1617768191
Отличный аддон!!!
on 1617747767
Simple, easy to use, and efficient while making langue learning flash-cards. Thank you very much.

PLEASE: add the option to add the example sentences to a field

Update: Excellent! Now, if it isn´t too much asking, please make it possible to add too the example sentences to a determined field on the cards.

Excellent add-on, simply excellent
Comment from author before post was edited
The add-on was updated and it should be possible now to add the example sentences.
on 1616672676
Revolutionized my cards making. Excellent. Pure gold. Thank you.
on 1616470117
Excellent! Thanks!
on 1615742236
Very useful! Thank you
on 1613282126
hi, really thanks for your hard work on this beautiful add on, I'm trying to translate more than one card at the same time with identical note type but I keep getting this error.I thought you may you have some fix for this. thanks again

Error:

Traceback (most recent call last):
File "C:\Users\dreameddumb\AppData\Roaming\Anki2\addons21\1536291224\__init__.py", line 205, in accept
assert len(nids) == len(translated), "Translated: {} notes != {}\n\n-------------\n{}\n-------------\n".format(len(nids), len(translated), urllib.parse.unquote(query))
AssertionError: Translated: 3 notes != 1

-------------
Staple
~~~
Sprawl
~~~
Tempest
-------------
hi, my friend.it seems that this error only happens when I want to translate English to Persian. in translating English to other languages I don't have any problem.in other words, I can translate English to Persian only a word at a time not batch translate.
Comment from author before post was edited
Maybe try to set Format from HTML to text. If it doesn't help, try to translate these 3 cards one at a time to see if it works or not. Maybe Google doesn't like some card and returns no translation.

Maybe export these cards, for example, with the Browser > Notes > Export Notes and contact me by email kelciour@gmail.com or create a new issue at https://github.com/kelciour/google-translate/issues ?
on 1608408367
Translation works very well, but when I try to include transliteration one of two things always happens. I am using Anki version Version 2.1.35 (84dcaa86).

First possibility: the transliteration does not appear at all or shows the transliteration of the source language, not the target language. (This only happened with English to Urdu.)

Second possibility: I get the following error. (This happened with English to Arabic/Hindi/Persian/Japanese.)

Traceback (most recent call last):
File "/Users/other/Library/Application Support/Anki2/addons21/1536291224/__init__.py", line 196, in accept
romanization += str(d[3] or "")
IndexError: list index out of range

Thank you for your add-on!! You are awesome!
on 1606378394
How can I translate a cloze field for making the translation without cloze code in?
on 1606170860
easy, simple, great!!
on 1604704269
Excellent!!
Thank you very much about the update.
on 1604384876
awesome!
on 1603698217
The previous errors have been fixed, thank you!

Works really well, I have only encountered two problems that was when translating cloze cards it sets them all as cloze 1, as in a card with {{c1::One}} and {{c2::Two}} becomes {{c1::One}} and {{c1::Two}}.

And the error 20 !=19 that a user pointed to happens when you try to translate several cards and one of them has the selected field empty, for example you have 4 basic cards and try to translate the "Back" field for all of the them, if one has that field empty it gives that error as 4 != 3.

The error "'NoneType' object is not iterable" happens when you try to translate only a single card with a field that is empty like in the error above.
on 1598967850
Great! Simple add-on, works as advertised. (You'll have to go through your cards manually afterwards to see if there are some weird translations, but that is to be expected from a machine translation.)
on 1598858373
It's a nice addon. Could you please build an addon that will help us to add the English definitions from google translator easily, please? I'm an English language learner so I make lots of vocabulary flashcards. copy and pasting are so boarding! Thank you
on 1598636427
Awesome Add-on!! Thank you very much!!
on 1597958010
Absolutely incredible - thank you so much, saved me so much time on something that would have taken me ages. Worked flawlessly.
on 1594495618
Very well!
on 1594195562
Fantastic!!! Thank you!
on 1593971064
Very fast!
I translate 3,500 sentences in 13 minutes. (german -> portuguese)
.
Correcting my opinion.
It works really well.
But, sometimes the google translation is horrible.
It would be amazing if you could use a dictionary website to translate. (example: pons, leo, reverso, cambridge, linguee...)
---
I saw your answer now.
I reinstalled Anki on my computer. Other plug-ins were also failing.
Sorry to be negative before.
Comment from author
Hi again. If you're still interested in DeepL Translate for Anki, I finally made the add-on and it'll be posted on Patreon. If you'd like to try it, let me know by email kelciour@gmail.com and I'll send a link to download it.

-------------------------

05.07.2020 Thank you for the upvote! I'm very glad to receive it.

Yes, I guess, DeepL Translate might work better for some text and languages, it'd be nice to have it too. Maybe it can be added later. It seems to be possible to implement it in the add-on either with or without the API key.

Though I'm not sure about other services. For now, I'm afraid, I won't be interested or have time to do it. But thank you for the suggestion! Very appreciate it!