Wednesday, September 28, 2005

[Debian] Ubuntu Chinese Setup

Install Ubuntu in English. The default locale is en_US.UTF8. And the 4 ttfarph fonts are installed by defalt also. What I need is input method only. Scim is a good choice.
A good tutorial can be found here: http://www.mrbass.org/linux/ubuntu/scim/
Below are quoted from that tutorial, I modified the code since I don't need Japaese and Korean IM:

Ubuntu 5.04 Hoary SCIM Chinese, Japanese, and Korean Input Guide
You can install CJK input via ubuntuaddon or do it via internet.
Ubuntu already comes with Chinese, Japanese and Korean fonts preinstalled.

To install via internet (universe repositories must be enabled)
sudo apt-get install scim-gtk2-immodule scim-chinese scim-tables-zh

Add SCIM to startup for X11
sudo touch /etc/X11/Xsession.d/74custom-scim_startup
sudo chmod 646 /etc/X11/Xsession.d/74custom-scim_startup
echo 'export XMODIFIERS="@im=SCIM"' >> /etc/X11/Xsession.d/74custom-scim_startup
echo 'export GTK_IM_MODULE="scim"' >> /etc/X11/Xsession.d/74custom-scim_startup
echo 'export XIM_PROGRAM="scim -d"' >> /etc/X11/Xsession.d/74custom-scim_startup
echo 'export QT_IM_MODULE="scim"' >> /etc/X11/Xsession.d/74custom-scim_startup
sudo chmod 644 /etc/X11/Xsession.d/74custom-scim_startup



Next two steps are OPTIONAL (scim KDE startup and input KDE apps while in GNOME)

If you installed kubuntu-desktop (KDE) and plan on logging into KDE session do this in terminal
sudo touch ~/.kde/Autostart/startscim
echo '"#!/bin/sh"' >> ~/.kde/Autostart/startscim
echo "scim -d" >> ~/.kde/Autostart/startscim
sudo chmod 745 ~/.kde/Autostart/startscim


While using GNOME:
you can input into GNOME, GTK apps but NOT KDE apps.

While using KDE you can input GNOME, GTK and KDE apps.
So if you want to also input in KDE apps while using GNOME do the following:
sudo touch ~/.gnome2/session-manual
echo "[Default]" >> ~/.gnome2/session-manual
echo "num_clients=1" >> ~/.gnome2/session-manual
echo "0,RestartStyleHint=3" >> ~/.gnome2/session-manual
echo "0,Priority=50" >> ~/.gnome2/session-manual
echo "0,RestartCommand=scim -d" >> ~/.gnome2/session-manual
echo "0,Program=scim" >> ~/.gnome2/session-manual


This will create two SCIM keyboards under GNOME though but allows you to input in KDE apps while in GNOME.

OpenOffice go to Options | Language Settings | Languages
- Default languages for documents
Asian choose Japanese,Chinese or Korean
- check Asian languages support to Enabled.

Close out of options first otherwise you won't see Asian Layout in the options menu.
Go to Options | Language Settings | Asian Layout
Kerning choose Western text and Asian punctuation
Character spacing choose Compress punctuation and Japanese Kana (if not using Chinese or Korean)
First and last characters choose Japanese,Chinese or Korean