Please see my latest update on May 13, 2011, below!
I like foreign languages. They are always entertaining, and remind me to respect those who have a hard time learning English as a second language. Since some people are stumbling onto this blog in search of a way to enable Japanese support in Mint, I will write down how I set it up to work on both my laptop and desktop (even though I did mention my setup very briefly in one of my earlier posts). By the way, this guide is 100% compatible with Daryna and not just Elyssa. This means you Ubuntu Gutsy and Hardy people should listen up as well.
First, how to install Japanese/Korean/Chinese support:
- Get “scim-bridge” from the repositories/Synaptic if you don’t have it already.
- Open up /etc/X11/xinit/xinput.d/scim with root access with any text editor. E.g., something like this: gksudo gedit /etc/X11/xinit/xinput.d/scim.
- Make the file look like this (the lines that start with # are all “comments” and do not affect anything at all):
XIM=SCIM XIM_PROGRAM=/usr/bin/scim XIM_ARGS="-d" XIM_PROGRAM_SETS_ITSELF_AS_DAEMON=yes GTK_IM_MODULE="scim-bridge" QT_IM_MODULE="scim-bridge" DEPENDS="scim,scim-anthy|scim-canna|scim-chewing|scim-pinyin|scim-hangle|scim-prime|scim-skk|scim-tables-additional|scim-m17n|scim-uim|scim-tables-ja|scim-tables-ko|scim-tables-zh"
- Now, keep these values for these variables in mind. You can open up a blank gedit document and copy/paste the stuff above into it for reference, because you’ll need it for the following step.
- Make /etc/X11/xinput.d/none and /etc/X11/xinput.d/default the same as the file we just edited. But, for extra safety, only copy/paste over the values for the variables that are in the /etc/X11/xinput.d/scim file (the ones shown up above in code font). There are other variables with values (or no values) in the none and default files that you do not need to touch, so leave these as is.
- Now, restart X. (X is the graphical window manager for Linux. It runs everything you see, and it also handles fonts and such, so you need to restart. Either log out and log back in (shortcut key for this is CTRL + ALT + BACKSPACE) or just reboot if you really feel like it.
- Now, there should be a little keyboard icon on the system tray/Panel. Right-click on it, and click on SCIM Setup.
- For FrontEnd -> Global Setup, choose English as your default keyboard layout.
- Update the hotkeys for FrontEnd -> Global Setup -> Hotkeys -> Next input method. The default hotkeys are a bit annoying for me. I like to set up a custom hotkey that is Control+Control_R+KeyRelease; so, when I press both CTRL keys, and then release the Right CTRL key, the input method changes to Japanese. If I do it again, the input method changes to Korean. Doing it again takes me back to my default English layout.
- In IMEngine -> Global Setup, uncheck the Other boxes. You don’t need these (uncheck both the English/European box and the RAW CODE box) as they are clutter and get cycled into your custom hotkey you set up above.
- Right-click on the keyboard in the system tray/Panel again, and this time, click on Reload Configuration. (I think you might have been prompted earlier when you made the changes I described above; but do it again just for good measure.)
- Again, restart X.
- Done! Now, you have a global hotkey of Control+Control_R+KeyRelease that works in ANY program — gedit, Firefox, and even the terminal!!! (The keyboard icon in the system tray will update whenever you press the hotkey to reflect your current selection.) Control+Spacebar switches between your Japanese or Korean input back to your English layout. (NOTE: If you never saw any keyboard icon in your system tray, then this is because you don’t have the Notification Area item added to your Panel. Do so, and it will show up.)
For French and German:
- In Start -> Preferences -> Keyboard, click on the Layouts tab and click on Add. Add the French layout and German layout, both with their default variants (unless you want Dvorak or something).
- In the same tab, click on the Layout Options button. Click on Layout switching, which should be bolded by default on Elyssa/Daryna. Now, for some reason, the default hotkey does not work for me on my basic QWERTY keyboard (no success on my laptop’s keyboard, either). Also, as much as I like the Both Alt keys together change layout option, it doesn’t work for me. But this one does: Right Win-key changes layout. So click this one. Try other ones if you really hate using the right windows key.
- Right-click on your Panel, and click Add to Panel. Click on the Keyboard Indicator item and add it.
- Restart X? I don’t remember. But it should be working right away, if I recall correctly. Notice how each time you press the hotkey, the indicator changes from “USA” to “Fra” to “Deu” and back again. Neat!
I hope you find these things useful. がんばって！
UPDATE July 12, 2008: For some reason, the Layout switching options for switching between English, French, and German input as described above does not work properly. It only works right after you set the shortcut key. After a reboot, it will not work. I think this is a bug, but it may be just my system.
UPDATE July 25, 2008: The Layout switching option not working is a bug present in Ubuntu Hardy. Details here.
UPDATE September 24, 2008: In Xubuntu 8.04.1, you can at least get the Keyboard Layout Switcher (an item that you can add to the Panel) to work properly by going into /etc/X11/xorg.conf, and adding the names of the layouts for the “XkbLayout” option, as well as updating the settings ins Keyboard Preferences to reflect whatever is defined for “XkbLayout”. So, for me, this setting was set to simply “us” before, for US English. I changed it to look like “us,fr,de”; then, I went into Menu -> Settings -> Settings Manager -> Keyboard -> Layouts, and added the proper US, FR, and DE layouts, in that order (although I doubt this proper order is necessary). Then, I also unchecked the “Use X configuration” setting as well in the same dialog box (I know, this is odd, considering how we want the changes reflected in xorg.conf to take effect). Now, after these two changes, the Keyboard Layout Switcher works correctly, even after a reboot. FYI, in the Keyboard Preferences dialog box mentioned above, I use the olpc2, oss_nodeadkeys, and nodeadkeys variants for the us, fr, and de layouts, respectively, and my keyboard model is Generic 105-key (Intl) PC.
Unfortunately, making it switch layouts via a keyboard hotkey, à la SCIM, is beyond me. Clicking on the flag icon in my Panel will do for now.
Also, as for the Korean + Japanese, as of Xubuntu 8.04.1, you’ll have to install the scim-hangul and anthy and scim-anthy packages to get the two languages to show up in your SCIM setup dialog box (my apologies for not mentioning this if this was also the case before).
UPDATE February 22, 2009 (on Arch Linux): I don’t use Xubuntu anymore — I use Arch Linux + Xmonad (no XFCE, no KDE, no Gnome, just Xmonad). From my experience on 2 installations of Arch (one on my desktop and one on my laptop), the layout switching between us, fr, and de all work with the following xorg.conf:
Section "InputDevice" Identifier "Keyboard0" Driver "kbd" Option "XkbModel" "pc104" Option "XkbLayout" "us,fr,de" Option "XkbOptions" "grp:rctrl_toggle" EndSection
That’s right — you can get layout switching functionality with just a couple lines in your xorg.conf file. The only quirk is that when I do press the right CTRL key to toggle between us, fr, and de layouts, the “us” layout is actually in there twice — i.e., I have to press the right CTRL key two times to switch from us to fr. (This quirk has been fixed now — see update on June 16, 2010 below.) But cycling between all of these layouts work all the time, and consistently, even after reboot! It’s just one more reason to switch to Arch Linux. BTW, scim works perfectly fine in Arch Linux — just put the following in your ~/.xinitrc file, BEFORE “exec xmonad” if you’re using Xmonad:
export XMODIFIERS=@im=SCIM export GTK_IM_MODULE="scim" export QT_IM_MODULE="scim" scim -d
Just follow the Arch wiki on SCIM for more details. Press CTRL+Space to bring up the scim pop-up window (assuming you’ve installed at least one input method, like scim-anthy or scim=hangul), and from there you can right-click on it to bring up the scim configuration window, for all your tweaking/hotkey customizations.
UPDATE March 26, 2009: You might want to be interested in this post I just wrote as well, for displaying good-looking Korean and Japanese fonts in your terminal/console.
UPDATE June 16, 2010: The quirky behavior of the layout “us” being there twice is now gone — I think the latest xorg updates (1.7 series, probably) have fixed that bug.
UPDATE August 24, 2011: I don’t use multiple xorg keyboard layouts any more; see this post.