Addon for translating a field with translation selection?

I am looking for the following and I wonder if it exists: when I add a word in my mother tongue on the front, instead of writing or copying the translations into the target language field, is there an add-on that when I click on that field gives me possible translations from a dictionary and lets me select one or multiple of them? I know that a deepL plugin automatically translates words, but that does not let me choose e.g. synonyms or the translation I want (when there are multiple).
I saw that there apparently was an addon called Anki-Translator, which does exactly that, but it is not maintained and disfunctional now.

1 Like

I fixed this add-on for Anki24+ and uploaded it to AnkiWeb.

add-on: :earth_africa:Anki Translator (Fixed by Shige)

Notes:

  1. I have not yet tested it in all languages, if it does not work please contact me.
  2. Some languages are not supported. If you want to support a language please request it to me.

Thanks a lot, that basically does exactly what I’d like. The only problem I see:
I try to translate from German to Russian, but no matter whether I mark either as source/target language and no matter if the cursor is in the German or the Russian field when I open the Translate-window, the selected translations always get copied into the wrong field, i.e. Russian first (where the German word is supposed to be) and German in the second field (where the Russian translation is supposed to be). Am I missing something or is this supposed to happen?

1 Like

This add-on seems to not have a function to select a field. I fixed it and updated it, If you update the add-on the fields should be reversed.

EDIT:
For some reason, now it’s working. Thank you!

(Solved)
Thank you, but now there is a very different problem all of a sudden: Whenever I change the language settings in init.py to “de” (Source Language) and “ru” (Target Language) as well as LoadGrammarInfos to “False”, I get an error and the following Debug Info whenever I hit the Translate button in the dictionary window. When I do a fresh reinstall of the add-on it works again, but as soon as I permanently change the source and target language, the error comes back.

Anki 24.06.3 (d678e393) (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Linux-6.1.0-25-amd64-x86_64-with-glibc2.36

Traceback (most recent call last):
File “/home/username/.local/share/Anki2/addons21/1552714896/TranslatorAddon/TranslatorDialog.py”, line 134, in translate
translations = self.parser.getTranslation(vocab, src, tgt, grammarInfos)
File “/home/username/.local/share/Anki2/addons21/1552714896/TranslatorAddon/Parser/PONSParser.py”, line 43, in getTranslation
genus = html.unescape(“”.join(genus.findAll(text=True)).strip())
AttributeError: ‘NoneType’ object has no attribute ‘findAll’

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Anki Translator Fixed by Shige [‘1552714896’, 2024-11-03T17:32, ‘None’, ‘’]
AnkiConnect [‘2055492159’, 2024-07-26T06:55, ‘None’, ‘’]
AwesomeTTS - Add speech to your flashcards [‘1436550454’, 2024-09-14T08:04, ‘None’, ‘’]
Button Colours Good Again [‘2494384865’, 2022-09-27T12:18, ‘None’, ‘’]
Change Interface Font [‘1431333984’, 2024-03-07T19:31, ‘None’, mod]
Customize Keyboard Shortcuts [‘24411424’, 2023-11-01T10:17, ‘None’, ‘’]
DeepL Translator [‘972129549’, 2024-04-26T22:11, ‘1.0.0’, mod]
ReColor [‘688199788’, 2024-03-03T02:45, ‘3.0’, mod]
Switch Note Type Hotkey [‘565948788’, 2021-10-04T05:46, ‘None’, mod]

===IDs of active AnkiWeb add-ons===
1431333984 1436550454 1552714896 2055492159 24411424 2494384865 565948788 688199788 972129549

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Enhance main window [‘877182321’, 2023-10-22T22:28, ‘None’, mod]
Review Heatmap [‘1771074083’, 2022-06-30T03:43, ‘None’, ‘’]

Sorry for double-post, but now it’s not working anymore. Even after a fresh install it does not translate, no matter which language.

Perhaps this error is displayed when the translation cannot be found, would it not work if you changed the words?

1 Like

You are right perhaps, when I look for easy obvious words, then it works. But then again some things are unexplainable with that solution, for example when I look for the translation of ро́вный, I get several German suggestions, but when I search for those vice versa (from German to Russian), I get the error message again, even though when they are in the RU-GER dictionary they should vice versa also be in the GER-RU database, I would assume?

That’s not clear until I look into it in more detail, there are a few other languages that are not supported, I’ll look into them later.

1 Like

After trying some more today, I think the problem is that the dictionary can not deal with German to Russian or Russian to German verbs. Only verbs. Nouns work fine.

1 Like

Thanks for the debug info, that’s helpful.