This article is a step-by-step guide to enabling Japanese input (hiragana, katakana, and kanji) in Ubuntu.
If you've ever seen the great way Mac OS X's built-in international input system magically transforms typed romaji to kana on-the-fly and wished you could do the same thing in Linux, you're in luck, thanks to a pair of great utilities: IBus and Anthy.
Once you install and configure IBus and Anthy, you can easily flip back and forth between English and Japanese input. It's great. Let's get started.
The current version of this article:
Step one: Avoid SCIM -- You may find, as you Google around, many references to SCIM. Ignore them. SCIM seems to have some issues in Karmic. For me, SCIM would run, but it would not actually... you know... work.
Step two: Install IBus and Anthy -- If you're in the shell, use the command 'sudo apt-get install ibus ibus-anthy', or use Synaptic to install ibus and ibus-anthy. (Installing both ibus and ibus-anthy is probably overkill since installing ibus-anthy will probably install ibus as well. However, if you explicitly install both, as I did, it will do no harm.)
Step three: Set your environment variables -- Add the following lines to your ~/.bashrc (or equiv):
# ibus export GTK_IM_MODULE=ibus export XMODIFIERS=@im=ibus export QT_IM_MODULE=ibus
Step four: Activate your environment variables -- Log out and log back in, or simply source your ~/.bashrc (or equiv).
Step five: Setup IBus -- At a shell prompt, type: ibus-setup
Step six: Set the input method to Anthy -- In the Input Method tab, use the "Select an input method" pop up menu to select Japanese Anthy. Now, click Add. Your Input Method list should look like so:
Note that I've moved Anthy to the top of the list. You'll want to do the same.
Step seven: Trigger IBus -- Launch an app you'd like to type into and use the default trigger (ctrl-space) to start IBus. (Or use whatever custom trigger you defined during set up.) Notice that the little IBus floating window thingy appears somewhere on your screen. The screenshot below shows the floating window with the Anthy kana/kanji selector activated.
Step eight: Try it out! -- Start typing romaji. Note how IBus-Anthy magically transforms your romaji into hirigana (or whatever you have selected in the kana/kanji selector). Pretty cool, eh?
Step nine: Turn it off -- The trigger (ctrl-space) toggles IBus on and off.
Step ten: Make IBus start when you log in -- There are several ways of accomplishing this, but one (slightly kludgey way) is to simply add 'ibus-daemon &' (without the quotes, obviously) to your ~/.bashrc (or equiv). You'll want to test this before logging out by sourcing your .bashrc, like so: source ~/.bashrc -- If you get a prompt back after running that source command, and if IBus is running, you're good! If you prefer to start IBus manually, simply type ibus-daemon& from a shell prompt whenever you want it running.
The next natural step is to make the Japanese fonts look good. I'm out of time for now, but once I tackle the Japanese fonts fixin', I'll post my findings here.
If you have questions or comments, drop me an email message. Thanks.