Input Japanese using UIM (English)
From ArchWiki
This page explains how to get the Japanese input to work using UIM.
If you use SCIM, see Smart Common Input Method platform.
Contents |
Installation
You need the following packages to input Japanese.
- Japanese fonts
- Kana-Kanji conversion engine: This article describes about Anthy.
- Input method: uim
Japanese fonts
see also Fonts for more detail.
Recommended Japanese fonts are as follows.
- VL Gothic (ttf-vlgothic)
- Default fonts of Debian-ja, Fedora-ja, Ubuntu-ja, Vine Linux, et al.
- UmePlus Gothic (ttf-umeplus)
- Default fonts of Mandriva Linux ja environment.
- IPA fonts (otf-ipafont)
- IPA fonts is one of the highest quality and free (open source) font set (IPA is an initialism of the 'Information-technology Promotion Agency, Japan', not 'International Phonetic Alphabet').
Anthy
First we need to install Anthy :
# pacman -Sy anthy
UIM
Using pacman
Pull down the necessary things with a :
# pacman -S uim
Compiling from source using PKGBUILD
For instance, in the case of the following, you should compile from source:
- Arch repo's package is out-of-date: It's
frequentlysometimes out-of-date :P - You want to use Anthy(UTF-8): As of uim 1.5.7, Anthy(UTF-8) support is disabled by default.
- You use KDE and want to use uim-qt-tools: All tools for Qt are disabled by default.
The one of the easy way to build from source is using ABS.
First, install ABS:
# pacman -S abs
Update ABS:
# abs
Then, copy uim's directory to under your $HOME. For example:
$ cp -R /var/abs/extra/uim ~/sources/
Next, edit uim/PKGBUILD. Typical build options are as follows:
- --with-anthy-utf8
- Enable Anthy(UTF-8) support
- --disable-gnome-applet
- Do not build gnome-applet. You can drop gnome-panel from makedepends (also optdepends).
- --with-qt4
- Build uim-tools for Qt (needs Qt)
- --with-qt4-immodule
- Build UimQt (Qt immodule support) for Qt4 (needs Qt)
This is a sample of custom PKGBUILD (enable anthy-utf8 support and drop gnome-applet) based on uim 1.5.7 in extra.
pkgname=uim pkgver=1.5.7 pkgrel=1 pkgdesc="Multilingual input method library" arch=('i686' 'x86_64') url="http://code.google.com/p/uim/" license=('custom') depends=('m17n-lib' 'ncurses' 'gtk2') makedepends=('pkgconfig' 'gettext' 'intltool') optdepends=() options=('!libtool') install=uim.install source=(http://uim.googlecode.com/files/${pkgname}-${pkgver}.tar.bz2) md5sums=('b84a43fb92d7ceb4bd801a76120c2a71') sha1sums=('fbea2590286ddc857a7824d8544cb08842f4299f') build() { cd "${srcdir}/${pkgname}-${pkgver}" ./configure --prefix=/usr --libexecdir=/usr/lib/uim \ --disable-gnome-applet --with-anthy-utf8 \ || return 1 make || return 1 make DESTDIR="${pkgdir}" install || return 1 install -D -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING" }
Finally, run makepkg under uim directory to make and install package:
$ makepkg -s -i
Setting the environment variables
Add the followings to your ~/.xsession(For XDM, KDM or GDM) or ~/.xinitrc(For startx from command line):
export GTK_IM_MODULE='uim' export QT_IM_MODULE='uim' uim-xim & export XMODIFIERS=@im='uim'
Toolbar utilities
If you want to use UimToolbar utilities, add one of the followings too.
uim-toolbar-*
Using toolbar appears as a window:
uim-toolbar-gtk &
or if you built --with-qt, you can add:
uim-toolbar-qt &
uim-toolbar-gtk-systray
Using toolbar for system tray:
uim-toolbar-gtk-systray &
Panel applet
Or, if you use GNOME, KDE or Xfce, you can use uim-toolbar panel applet (Xfce requires xfce4-xfapplet-plugin to use uim-applet-gnome).
UIM preferences
You can configure uim preferences by running :
$ uim-pref-gtk
which brings forth a GUI.
You can run uim-xim or logout/login to test your settings.
Provided everything went well you should be able to input Japanese in X.
お疲れ様です!
Troubleshooting
Cannot input Japanese on Opera
If you use Opera and cannot input Japanese with uim, try to edit environment variable as follows:
export QT_IM_MODULE='xim'
uim-toolbar-gtk-systray: tray icon is crushed
uim-toolbar-gtk-systray isn't compliant with freedesktop.org system tray specs. You have to choose just one of the items in toolbar to solve it. The steps to display only 'Input mode' icon for example as follows:
- Run uim-pref-gtk.
- Click 'Toolbar' on 'Group' list.
- Take the all checkmarks off.
- Click 'Anthy' or 'Anthy (UTF-8)' which you are using on 'Group' list.
- Click Edit button in 'Toolbar' box -> 'Enable toolbar buttons' line.
- Enable only 'Input mode' and click 'Close' button.
- Click 'OK' button to close uim-pref-gtk.
The tray icon will be displayed "あ" (Hiragana mode) or "ー" (Direct mode).
Useful literature
http://code.google.com/p/uim/wiki/OfficialUserDocument
http://en.wikibooks.org/wiki/Uim