Writing Japanese on Linux

These are my notes about how I got my Debian unstable machine to accept Japanese text. I've recently started doing a beginner's Japanese evening class so I wanted to be able to type Japanese text without having to keep looking up Unicode numbers for the characters.

I'm using UIM and Anthy. It seems to work fairly well, but it doesn't seem to be particularly well documented. The Anthy website is in Japanese, which isn't much good to me at this stage.

You need to run a uim-xim process and use some environment variables to tell other programs to use it. Put this stuff in your .xinitrc or .xsession file:

export XMODIFIERS=@im=uim-anthy
export GTK_IM_MODULE=uim-anthy
export QT_IM_MODULE=uim-anthy

uim-xim --engine=anthy &

Then run uim-pref-gtk and select ‘Anthy’ as the default input method. I also changed the on/off keybinding in ‘Global key bindings 1’ to Control-space, because I kept typing Shift-space by accident.

After doing all that, I can run a UTF-8 terminal like this (having switched to Gnome terminal from XTerm because the Unicode stuff just works):

export LC_ALL='en_GB.UTF-8'
gnome-terminal &

and then hit Control-space and start typing in hiragana. Hit space to search for other spellings (with different kanji, or in katakana), and return to select one.

One thing this is already useful for is searching in the EDICT Japanese dictionary file. It's available in Debian in the edict package, as a plain text file, but it's in the EUC-JP encoding. You can convert it to a more useful UTF-8 file like so:

iconv -f euc-jp -t utf-8 edict >edict-utf8

And then use it for quick look-ups of Japanese words from a shell:

$ grep 日本語 edict-utf8
日本語 [にっぽんご] /(n) Japanese language/
日本語 [にほんご] /(n) Japanese language/(P)/
...

I haven't managed to get this working in gvim yet. When I tried turning it on, it would be in Japanese mode by default (which isn't what I'll usually want), and then it would switch back to normal mode and be quite tricky to get back into Japanese mode again. I'm not sure what I'm doing wrong there. I can use vim in a Gnome terminal though, and use the terminal's input method support inside vim. That seems to work fine.

< Now with added soy | The Devil's Interval >

Miniblog

(nuggets of inanity)

Tuesday Apr 24th 2007, 16:54 »
Just took the annual web design survey that AListApart do. I don't realy consider myself to be a web designer, but I have been doing a lot of HTML and CSS lately.
Monday Apr 23rd 2007, 18:23 »
Strange, there appears to be a bare-knuckle boxing match going on in the field outside my flat. Wish they wouldn't make so much noise about it.
Thursday Mar 1st 2007, 18:47 »
“In its written form, Hebrew has no vowels, making it the ideal language for texting.”
—Said in jest on some Radio 4 programme just now.

Archive: 2007 · 2006 · 2005 · 2004
Feed