Quick and Dirty Japanese in FreeBSD

Japanese support under UNIX traditionally sucks. There are literally
more than 5 different input methods, each of which interface with a
multitude of conversion engines, which spit out characters in a variety
of character sets - and applications only support certain combinations
of them. It's not that any one of the combinations is hard to implement
per se, but knowing which to use and which go together can be hard to
determine for a novice. The goal of this guide is to give you a working
Japanese input and display system with the least amount of thinking.

The current version of this document applies to using the SCIM input
method and the Anthy conversion engine, and uses UTF-8 encoding.
This works well for modern GUI apps(anything GTK or QT-based will
work), but isn't so great for some "legacy" applications. For the
previous version of this document, which used Canna/EUC, check here.

If you'd like to learn more about Japanese input methods in general,
here is a good place to start.

You need the following ports.

Required: 

/usr/ports/japanese/scim-anthy		# This installs the SCIM input framework and the anthy conversion engine
/usr/ports/japanese/scim-tables		# This installs the actual Japanese input methods for SCIM
/usr/ports/japanese/kochi-ttfonts	# Just a Japanese TrueType font

Optional (but recommended): 

/usr/ports/x11/gnometerminal          # gnometerminal works fairly well - so should any gtk/qt based terminal
/usr/ports/editors/vim-lite                 # VIM may suck, but it supports UTF-8, and nvi doesn't.
/usr/ports/japanese/w3m                  # A text based web-browser with Japanese support

After the ports are installed:

- Put the following in your .xsession or .xinitrc file (before you
  execute your window manager, obviously):

LC_CTYPE=ja_JP.UTF-8; export LC_CTYPE
xyaku &
scim -d

- Edit the "Files" section of your XF86Config or Xorg.conf. Insert the following line:

	FontPath     "/usr/local/lib/X11/fonts/TrueType/"

- Restart X, start a GTK or QT app, hit ctrl-space to start SCIM, and test your new Japanese input.

- Return to this page with w3m, and you should see the following
  as hiragana: ひらがな

- Test out xyaku - highlight a simple English word, and hit "ctrl-F1".
  You should see a popup with the definition of that word.


Updated: Wed Feb 27 10:29:34 PST 2008

© 2003-2008 lx