Chirp on iBook

20130325-113605.jpg

Thanks, Debian.

Advertisements

More Japanese on Linux: Anthy, uim, and Ubuntu (among others)

I still haven’t gotten around to updating the Ubuntu box running Gutsy Gibbon out in the den here in Sterling. It seems to be running just fine with Gnome 2.20.1 and I’m in no hurry to jump to Hardy Heron and mess with my users’ interface experience. So, I went about checking how a few things work in Gutsy, on the odd chance I might want to type something up while here, without firing up the laptop.

I’ve been running the new release of Opensuse on the Thinkpad (post on that to follow, after I spend a little time with it). For the most part, setting up uim for kanji input is about the same across distros (and BSD’s!). I noticed the Opensuse konqueror binary has uim suport built right in, obviating the need for uim-xim, and the concomitant config file hacks necessary to run a mixed gtk/qt environment. Just right click in a text input area in any QT app and select uim under input methods, if you haven’t already made it your system wide default.

I blogged on setting up Japanese in Gnome and KDE apps in each other’s environments a while back. Since then, I’ve figured out (stumbled upon) some things to make it easier and much less hacky, but haven’t properly documented my discoveries. Plus, I’ve been lax about going into much detail on uim-gtk-pref settings, since preferences do vary so much. I’ll remedy that with some basic screenshots of what works for me. Feel free to experiment to taste. By the way, I wouldn’t expect much difference in these settings for a given Debian release, or other Ubuntu version, but let me know of any gotchas that might come up.

First things first. I’ll assume you’ve got the requisite packages: uim-anthy, uim-applet-gnome, uim-gtk2.0, uim-xim, uim-utils. Installing these via apt-get, synaptic, what-have-you, should pull in all the dependencies you need. Now all that’s left is to add the uim-applet to the Gnome toolbar, right click on it. and select preferences. NOTE: the GTK applet will work exactly the same in a KDE panel, but there is also a KDE uim applet, if you’re into that.

uim-pref-gtk Global preferences, along with version window
uim-pref-gtk Global Settings

The Global Settings controls the input method framework, which would be uim in this case. The actual input method here is Anthy. So, this handles turning on any special input framework. Then you can choose to either use Anthy to input kanji immediately, or you can toggle between direct, kanji, or different kanas, or set one of those as the default. Confused? Just try my settings, play a little, and see what changes. Make sure to click apply.

My working anthy settings in uim-gtk-pref
My working Anthy settings in uim-gtk-pref

This menu controls how Anthy behaves once activated from the applet. I start with direct Roman character input, and I can toggle to kanji input via romaji transliteration with shift-space.

Advanced Anthy Setting in uim-pref-gtk
Advanced Anthy Setting in uim-pref-gtk

A few more preference settings for Anthy. I like predictive input. You may not.

Toolbar applet gimmicks and effective area in which to switch input
Area in which to activate an input method and various toolbar applet gimmicks

I usually have different applications open using different languages, so I like to just switch one at a time. One can change input for the whole desktop at once if preferred.

Those other programs: make it work with KDE, QT, X, GoogleEarth, etc.

Now how about those KDE apps like konqueror and k3b? And what about other non-GTK applications, such as xterm and GoogleEarth? In Ubuntu you just have to get uim-xim running and tell XIM (the old X input system) to use the uim settings you’ve been so carefully rigging up. I found an excellent how-to on this for Zenwalk Linux, which helped get me started. I put this script:

if [ "$DISPLAY" ]; then
uim-xim -engine=anthy & > /dev/null 2>&1
export XMODIFIERS=@im=uim > /dev/null 2>&1
fi

in my .profile. In my case, I first backed up the default .profile and then added the uim-xim startup code to the original. We’re not done just yet.

We want to set the default input method for XIM to uim. This is accomplished by adding:

export XMODIFIERS=@im=uim

to .gnomerc in your home directory. If the file doesn’t exist, just create it. That worked for me.

Check it out

Now we just have to log out and log back in to make sure those configs take effect.
Open konqueror, Google Earth, any old program, and activate Japanese input from
the uim Applet and have at it.

Closing thoughts:
There’s a handy keystroke chart here, for those characters that might be less than intuitive to typists
who haven’t studied advanced linguistics. Who knew the katakana dot was called an interpunct? Makes
perfect sense though, doesn’t it?

Coming Soon:
How to do all this in KDE.
ヒント: It’s not that different. A few scripts in different places. Ho hum.

Feedback
Keep those comments coming! Let me know if this helps, or doesn’t.