How to make SCIM work with Anki
If you’re studying Chinese, Japanese or Korean and use a Linux operating system, you’ll probably discover that SCIM (‘Smart Common Input Method’, the input system for CJK languages) does not work with Anki (a piece of brilliant SRS study software).
When you press ctrl + space to trigger CJK input in Anki, nothing happens. This is pretty disappointing.
Fixing SCIM in Anki
The problem is nearly always fixable though, and it only takes a few minutes to sort it out.
This article takes an ‘all bases covered’ approach, in the hope of catching whatever error is causing SCIM not to trigger in Anki. Your best bet is probably to go through the steps here and test SCIM input in Anki after each one; there’s no point making further changes once it’s working.
Input method selected
The first thing is to check that SCIM is set as the input method in your system’s settings. On Ubuntu or Linux Mint, go to Administration → Language Support and make sure that where it says ‘Keyboard input method system:', ‘scim-bridge’ is selected:
[caption id="attachment_1449” align="aligncenter” caption="Click for full size”][/caption]
Some settings in SCIM
It’s also a good idea to check that your keyboard layout is correctly set in SCIM, and to disable one of the options. Open up SCIM settings, set your keyboard layout and uncheck the option that says ‘Embed Preedit string into client window’:
[caption id="attachment_1451” align="aligncenter” caption="Click for full size”][/caption]
X input method
It might also be necessary to set SCIM as the input method in X’s settings (X is the window manager in a lot of Linux distros). You just need to edit one file:
sudo gedit /etc/X11/xinit/xinput.d/scim
And find these two lines:
GTK_IM_MODULE=xim QT_IM_MODULE=xim
Change those two lines to the following:
GTK_IM_MODULE=scim-bridge QT_IM_MODULE=scim-bridge
Locale
Another potential problem might be an incorrectly configured or incomplete locale in Anki’s settings.
To find out the locale of your system, run this in a terminal:
locale
You should get a list of variables. The top one is what you want; copy what it says after ‘LANG=’, for example:
LANG=en_GB.utf8
Now open another file:
sudo gedit /etc/scim/global
And add what you copied to the line ‘/SupportedUnicodeLocales = ‘, using commas to separate multiple locales. For example:
/SupportedUnicodeLocales = en_GB.utf8,en_US.UTF-8
Python QT
Anki uses the Python QT module, and this often fails to work with SCIM.
Make sure you’ve got scim-bridge-client-qt4 and python-qt4 installed:
sudo apt-get update
sudo apt-get install scim-bridge-client-qt4 python-qt4
Then edit a file to make sure QT applications (and some others) know to use SCIM as an input method:
sudo gedit /etc/profile
Go to the bottom of that file and add this:
SCIM
export XMODIFIERS=’@im=SCIM’ export GTK_IM_MODULE="scim-bridge” export XIM_PROGRAM="scim-bridge -d” export QT_IM_MODULE="scim-bridge” scim -d
QT Config
It may be necessary to install a GUI to play with the settings for python qt:
sudo apt-get install qt4-qtconfig
Once that has installed, run:
qtconfig
This will bring up the GUI. The settings we want to change are on the ‘Interface’ tab. At the bottom of this tab, check that ‘Default Input Method’ is set to ‘scim-bridge’. It might also be necessary to change ‘XIM Input Style’ to ‘Over The Spot’:
[caption id="attachment_1454” align="aligncenter” caption="Click for full size”][/caption]
Now log out and in (or restart) to refresh all the relevant programs. SCIM should now be working in Anki.
Some other things to try
If none of that worked, there are still some options left. In the steps above, ‘scim-bridge’ was used as the input module in all cases. You could try replacing this with ‘scim’ or ‘scim-immodule’.
There’s also a SCIM input module specifically for QT applications, so it may be worth installing that and setting it as the input method for QT:
sudo apt-get install scim-qtimm
Then in the steps given above, use ‘scim-qtimm’ as the input module wherever QT is mentioned.
If none of this works, then unfortunately it may be time to start reinstalling things (SCIM, Anki, even the OS if you think it’s worth it).
Good luck!