Language Keyboard Auto-switch [Official Support Thread]

If you have a problem with the add-on language keyboard auto-switch post in this thread. This way I get notified. If you make a new thread I will likely miss it.

1 Like

Hi, thanks for your work with this addon.

Unfortunately I cannot get it to work after installing on version 2.1.54 on Windows 10. The following error message occurs upon startup:

An add-on you installed failed to load. If problems persist, please go to the Tools>Add-ons menu, and disable or delete the add-on.

When loading ‘⁨Language Keyboard Auto-switch⁩’:
⁨Traceback (most recent call last):
File “aqt.addons”, line 244, in loadAddons
File “C:\Users\David\AppData\Roaming\Anki2\addons21\1606509029_init_.py”, line 29, in
from .QSwitchControl import SwitchControl#.QSwitchControl
File “C:\Users\David\AppData\Roaming\Anki2\addons21\1606509029\QSwitchControl_init_.py”, line 22, in
from .QSwitchControl import SwitchControl
File “C:\Users\David\AppData\Roaming\Anki2\addons21\1606509029\QSwitchControl\QSwitchControl.py”, line 89, in
class SwitchControl(QCheckBox):
File “C:\Users\David\AppData\Roaming\Anki2\addons21\1606509029\QSwitchControl\QSwitchControl.py”, line 91, in SwitchControl
animation_curve=QEasingCurve.OutBounce, animation_duration=500, checked: bool = False,
AttributeError: type object ‘QEasingCurve’ has no attribute ‘OutBounce’

(I changed nothing after installing the add-on using the code). Thanks for your assistance.

Hi, sorry about that. Are you using Anki qt 5 or 6?

1 Like

It turns out I was using Qt6. Switching to Qt5 did resolve the error.

Ok. Thanks for letting me know. I’ll add a note on the extension page.

Hi, I’m seeing this error when trying to use the plugin.

Untitled

I’m on Win 10, running Anki Version ⁨2.1.49 (dc80804a)⁩ Python 3.8.6 Qt 5.14.2 PyQt 5.14.2

I am a bit of a noob with Anki, so I just set my deck up based on another one I saw, which means I have some cards english > japanese and some japanese > english in the same deck. They both have typing on the front and answers on the back, so I love the idea of the eng>jpn cards using my default keyboard and jpn>eng auto-switching to Japanese IME, but I’m not sure if this plugin works for that since both ‘typing’ fields show on the front? If not, would you mind walking me through how I can set them up to be able to use this plugin? Sorry for the trouble ><

1 Like

Sorry about that. I believe it’s because you are using 2.1.49. Try installing a newer version of the Qt 5 branch. Versions 2.1.50 and newer of Anki should have that module included by default. I’ve updated the addon page now to indicate the minimum version should be 2.1.50 because I didn’t realize this originally.

I think the way I programmed it is that it is based on what is set as the front or back for the card. So if you have a reversed card, it would still work. If you mean that you have cards with Japanese set on the front box for some and Japanese on the back box for some, that will probably cause issues.

Spanish Cards Ex.:


Screenshot 2022-10-16 053451

I can provide more info. for setting up the decks if you want. Let me know if that doesn’t work, and if you still want help or any guidance even if that works.

1 Like

Thanks so much for your help!! I updated Anki and can see the Add-on in my tools now. I set it up for the subdeck I want to use, but I’m not noticing the keyboard auto-changing so I think my cards must not be set up right. (I enabled “use a different input method for each window” as recommened)

I’m using a modified template that I got online, but when I was adding words to the deck it automatically duplicated them so I think they have reversed types, but I don’t know. They don’t have a front/back property like yours do, just japanese_kana and english which are the two that get tested when typing, and kanji doesn’t.

Untitled



Really sorry about the delay, but I think I found a solution. I realized the Front and Back value I was reading for the side was actually just the name anki had for the field being typed on the card. I added an option in the settings for each deck (in the keyboard chooser submenu), so that this could be changed if the field names are different like yours. The new version should be up now.

For yours for example:
image

1 Like

Yes, that’s done it!! Thank you for all your help, you really went above and beyond!

It turns out the Japanese keyboard automatically defaults to writing in Roman letters instead of Japanese which is annoying, but according to google it’s the same for both Microsoft and Google keyboards and there’s no real solution. At least with your switcher I’m only having to do one button press to switch the Japanese keyboard into hiragana instead of English > Japanese > Hiragana input and vice versa, so I really appreciate it :laughing:

1 Like

I’m sorry for the sudden asking… Is this script works on AnkiMobile?

It only works on Windows.

Does it still work? It’s not working for me. I select the keyboards I want to use and fill out the fields but the keyboard doesn’t swap when I move from field to field. Any help would be appreciated.

1 Like