Debian Chinese How-To
By Yien Bin

This is my personal experience with chinese environment setup on my Debian Box, with KDE desktop.

Here is my specs.

  • Debian Unstable, kernel 2.6.18-1-686
  • xserver-xorg 7.1.0-4
  • kde 3.5.5

50px-Debian-OpenLogo.svgSetting your system with english locales, so that your desktop, menus and programs’ file menus won’t show english characters in blurry chinese ttf fonts. You will still have the ability to input chinese in almost everything(browsers, konquerer, instant messengers, konsole, xchat and more).
Here is a step by step instruction.

  1. Setting UTF-8 Locale system wide

    dpkg-reconfigure locales

    This command will prompt you a screen to select your desired locales. For my case, I have selected

    1. en_US ISO-8859-1
    2. en_US.UTF-8 UTF-8
    3. zh_CN GB2312
    4. zh_CN.GB18030 GB18030
    5. zh_CN.GB18030 GB18030
    6. zh_CN.GB18030 GB18030
    7. zh_TW BIG5
    8. zh_TW.UTF-8 UTF-8

    Set en_US.UTF-8 UTF-8 as default locales. By now, when you output your locales settings with locale command, all the variables with “LC_XXX” shoud be already in “en_US.UTF-8“.

    65px-Zhongwen.svg

  2. Displaying Chinese

    There are a few packages you need to get in order to get chinese text displayed correctly in your KDE desktop.
    These are for KDE Internationalization.

    • kde-i18n-zhcn (for Simplified Chinese)
    • kde-i18n-zhtw (for Big5 Chinese)

    You can always add your desired encoding for other languages. I have also kde-i18n-ko for korean, and kde-i18n-ja for Japan.
    After installing the internationalized packages, you will have to install TTF(true type fonts). Here’s the list.

    • ttf-arphic-bkai00mp (“AR PL KaitiM Big5″ Chinese TrueType font)
    • ttf-arphic-bsmi00lp (“AR PL Mingti2L Big5″ Chinese TrueType font)
    • ttf-arphic-gbsn00lp (“AR PL SungtiL GB” Chinese TrueType font)
    • ttf-arphic-gkai00mp (“AR PL KaitiM GB” Chinese TrueType font)
    • ttf-arphic-uming (“AR PL ShanHeiSun Uni” Chinese Unicode TrueType font)
    • ttf-fireflysung (“AR PL New Sung” Chinese TrueType font)
    • ttf-kochi-gothic-naga10 (Kochi Subst Gothic Japanese TrueType font)

    My default chinese font is ttf-fireflysung which I’ve forgot where to get. I remember getting it from a Taiwan site, if any of you have the address, please kindly let me know. If you are unable to get firefly, uming is probably your best choice for chinese text.

  3. Changing font for chinese text display

    Sometimes in your KDE desktop, if you have downloaded files with chinese/japanese file names, it will be displayed in square unreadable characters. This means KDE is unable to find appropriate font substitution for unknown characters. You can get qt3-qtconfig to deal with this problem. Inside the program you will get to set font substitution for your default KDE font(mine is Bitstream Vera). Apply several substitution TTFs like AR PL New Sung and AR PL ShanHeiSun Uni, so your text will be displayed correctly.

    For other programs like Firefox, Xchat, amarok and more. You will get to choose their own default font. For my case, once qt3-qtconfig is set properly, these programs have no problem using the settings.

    If above methods still do not work out for you. You can try also install gtk2-engines-gtk-qt. This program will use your Qt settings to draw your GTK applications’ user interface, including the fonts of course. You should also check with

    update-alternatives –config qtconfig

    to see whether which qt config is currently in use. If you have used qt3-qtconfig, you definitely should choose “/usr/bin/qtconfig-qt3″ as your default.

  4. Chinese Input Method

    IMO, scim is always the best choice because it has pinyin support, the only chinese input method I’m familiar with. You will have to get these packages.

    • scim
    • scim-chinese
    • scim-gtk2-immodule
    • scim-modules-socket
    • scim-pinyin
    • libscim8c2a

    In order to get scim to work in almost everywhere in KDE, some settings need to be done.
    First, in your ~/.bashrc file, add in this line.

    export LC_CTYPE=”zh_CN.UTF-8″

    This will export your LC_TYPE as zh_CN.UTF-8 since we have already set all these to en_US.UTF-8. This is per user’s local setting, for my case I’ve set my LC_TYPE to zh_CN.UTF-8 system wide, with this command.

    dpkg-reconfigure localesconf

    Use this command to set scim as your default input method for X.

    update-alternatives –config xinput-all_ALL

    Again this is my system wide setting. For user’s local setting, add these lines in your ~/.bashrc

    export XIM=SCIM
    export XIM_PROGRAM=/usr/bin/scim
    export XIM_ARGS=”-d”
    export GTK_IM_MODULE=xim
    export QT_IM_MODULE=xim

    Restart your X-server, and login to KDE. In any text input field(Gaim, Firefox, Xchat, Open Office, Thunderbird and more), when you hit CTRL+Space, the scim toolbar will pop up and you are able to input chinese text. CTRL+Space again to switch back to English.

    Remember not to install the Skim(KDE frontend for scim), as it will somehow freeze your keyboard frequently.

A very useful page at http://www.unifont.org/fontguide/, you might want to check it out.

Yien Bin is a part-time tech blogger. Debian is his favorite operating system. His blog can be found at http://www.nixser.com