ひらがな (Hiragana), カタカナ (Katakana), and 漢字 (Kanji) Input in Gnome

A few days ago I decided to start learning Japanese. I expected to have a difficult path ahead of me, as Japanese is a notoriously difficult language for westerners to learn. After running up to my local bookstore, and picking up several books and CDs on the Japanese language, and getting the Adobe Shockwave plugin installed using Crossover Office (A great version of wine, I definitely recommend it if you find the vanilla wine to be too cumbersome); and making myself slightly poorer buy getting a subscription to the online version of Rosetta Stone I found myself facing a difficulty that I hadn’t originally expected. My English version of Slackware with Dropline Gnome and a US keyboard layout allowed me no easy way to insert Japanese script into documents. This meant that I would have difficult learning to read and write Japanese, as well as practicing Japanese by talking with my Japanese speaking friends online.
Knowing that there had to be a solution to this problem, I set out on the internet to find out. Unfortunately, the general (and reasonable) assumption is that if you want to be able to input Japanese characters, you probably read Japanese. For someone just learning the language, I found a lot of the documentation rather incomprehensable. With some effort I figured out how to get everything working, and have here a guide that should help others who want to enable Japanese character input.

To start with, you will need 3 packages. I’ve provided a mirror of the packages here since I had some trouble tracking them down.

  • Canna Server is a daemon that converts english characters into Kana
  • Im-Ja A utility to allow you to type in romanji and get the appropriate characters
  • scim A utility used by im-ja to talk to the canna server

If you don’t have it, you will also need the xmkmf utility; this was already available on slackware, and is probably available for your distribution as well.
Start by installing the canna server, scim, and im-ja in that order. Building the packages is fairly simple, just extract them, and run:

xmkmf
make Makefiles
make
make install

After the packages have been installed, you need to edit your gtk.immodules command:

sudo vim /etc/gtk-2.0/gtk.immodules

and append the following lines:

"/usr/lib/gtk-2.0/2.10.0/immodules/im-ja.so"
"im-ja" "Japanese" "gtk+" "/usr/share/locale" "ja"

Note: replace 2.10.0 with your version of Gtk+
Next, run the im-ja-conf utility, and set your shortcut keys. In my configuration, I have:

  • Switch to next input mode – CTRL space
  • Set direct input mode – MOD4 (windows key) n
  • Toggle hiragana/direct mode – MOD4 h
  • Toggle full/half-width katakana mode MOD4 k

Log out of Gnome and back in so that all of your applications will have the appropriate libraries available.
Once you are back in Gnome, if you want to enter some japanese characters, in a text box, right click and choose Input Mode -> Japanese Start typing in romanji and the characters will appear in a small floating text box. Use space to select characters or finish entering a word.
With these tools in hand, you can easily begin learning Japanese, or set up a machine that is usable for someone already familiar with the language. If you are learning Japanese, you might also find the Kanatest program useful. It will allow you to test and practice your knowledge of japanese characters!

Leave a Comment

You must be logged in to post a comment.