[OT] Mini howto: Scim, Chinese, Emacs and Mandrake 10.1 Community

"Rodolfo Medina" <[email protected]> Fri, 11 Mar 2005 12:04:19 +0100
Newsgroups gmane.emacs.mule
Message-ID <[email protected]>
It was also thank to the help provided from this mailing list that I
managed to configure my system in order to input chinese characters
with scim. I'm attaching a complete report of the steps I followed in
case it might turn to be useful to others.
(There might be error and imprecisions.)

The whole matter was not easy, and I hope that such detailed step by
step reports, necessary for non expert people, will be written also
for other linux distributions, thus sparing weeks and weeks of time and
work.

Thanks again,
Rodolfo
scim-mdk10.1CE.txt (text/plain, 5.9 KB)
	 January 2005: scim and Mandrake Linux 10.1 Community

When I installed Mandrake 10.1 Community, I chose the following
package installation:

- Office Workstation;
- Multimedia station;
- Internet Station;
- Configuration;
- KDE Workstation,

and chose British English as language, and an italian keyboard.

1)  I installed Emacs CVS 21.3.50.1, dated 2005-01-20. Then,
    # urpmi gettext
    # urpmi gcc-c++
    # urpmi perl-XML-Parser
    # urpmi libGConf2_4-devel
    # urpmi libgtk+2.0_0-devel
    (the latter already installed before, when installing Emacs CVS.)
    # urpmi locales-it
    # urpmi locales-zh

2)  I checked the output of 'locale':

    [rodolfo@localhost rodolfo]$ locale
    LANG=en_GB
    LC_CTYPE=en_GB
    LC_NUMERIC=en_GB
    LC_TIME=en_GB
    LC_COLLATE=en_GB
    LC_MONETARY=en_GB
    LC_MESSAGES=en_GB
    LC_PAPER=en_GB
    LC_NAME=en_GB
    LC_ADDRESS=en_GB
    LC_TELEPHONE=en_GB
    LC_MEASUREMENT=en_GB
    LC_IDENTIFICATION=en_GB
    LC_ALL=

3)  From Internet I downloaded scim-1.0.1.tar.gz and
    scim-chinese-0.4.2.tar.gz, copied the two packages into the ~/tmp
    dir and:
    $ cd ~/tmp
    $ tar xzvf scim-1.0.1.tar.gz
    $ cd scim-1.0.1
    $ ./configure
    $ make
    (about 10 minutes)
    # make install

4)  $ scim
    , and a small icon appeared left below; Ctrl-c to stop scim.

5)  $ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

6)  From within the ~/tmp dir,
    $ tar xzvf scim-chinese-0.4.2.tar.gz
    $ cd scim-chinese-0.4.2
    $ ./configure
    $ make
    (about four minutes)
    # make install

7)  The file ~/.i18n didn't exist. I created it, and put in it 
    the following lines:

    LANGUAGE=it_IT:it
    GTK_IM_MODULE=scim
    LC_ADDRESS=it_IT
    LC_COLLATE=it_IT
    QT_IM_MODULE=scim
    LC_NAME=it_IT
    LC_NUMERIC=it_IT
    LC_MEASUREMENT=it_IT
    LC_TIME=it_IT
    LANG=it_IT
    LC_IDENTIFICATION=it_IT
    LC_MESSAGES=it_IT
    LC_CTYPE=it_IT
    LC_TELEPHONE=it_IT
    LC_MONETARY=it_IT
    XIM_PROGRAM="scim -d"
    LC_PAPER=it_IT
    XMODIFIERS=@im=SCIM
    
8)  # emacs /usr/local/etc/scim/global
    , and changed the line
    
    /SupportedUnicodeLocales = en_US.UTF-8
    
    into
    
    /SupportedUnicodeLocales = en_US.UTF-8,it_IT.UTF-8,zh_CN.UTF-8
    
    , then closed Emacs and rebooted, 
    and found that the output of 'locale' was changed:
    
    [rodolfo@localhost rodolfo]$ locale
    LANG=it_IT
    LC_CTYPE=it_IT
    LC_NUMERIC=it_IT
    LC_TIME=it_IT
    LC_COLLATE=it_IT
    LC_MONETARY=it_IT
    LC_MESSAGES=it_IT
    LC_PAPER=it_IT
    LC_NAME=it_IT
    LC_ADDRESS=it_IT
    LC_TELEPHONE=it_IT
    LC_MEASUREMENT=it_IT
    LC_IDENTIFICATION=it_IT
    LC_ALL=
    
9)  Type and read chinese characters using kwrite:
    $ scim
    and, in another console,
    $ LC_CTYPE=it_IT.UTF-8 kwrite
    . This way kwrite opened up. 
    I did Ctrl-space and the scim toolbar appeared, 
    and I could input simplified and traditional Chinese.
    Before saving the file, from within kwrite, select 
    View -> Set Encoding -> Unicode ( utf8 )
    . When you want to open the file, start kwrite with 
    '$ LC_CTYPE=it_IT.UTF-8 kwrite',
    then select 'View -> Set Encoding -> Unicode ( utf8 )' 
    and then open the file.

10) From: http://ftp.cdaan.com/sy/light/simsun.ttf 
    I downloaded simsun.ttf
    and put it into the directory /usr/X11R6/lib/X11/fonts/TTF,
    then added the following lines to the files 
    '/usr/X11R6/lib/X11/fonts/TTF/fonts.dir'
    and '/usr/X11R6/lib/X11/fonts/TTF/fonts.scale':
   
    simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-ascii-0
    simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
    simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-gbk-0
    simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-ibm-cp850
    simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-iso10646-1
    simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-iso8859-1
    simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-iso8859-15
    simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-koi8-r
    simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-big5.eten-0

11) I added the following lines to .emacs:
    (set-language-environment 'chinese-big5)
    (utf-translate-cjk-load-tables)
    (set-language-environment 'utf-8)

    The file .Xdefaults didn't exist: I created it and added to it the following:

    Emacs.Font: fontset-song
    Emacs.Fontset-0:-*-fixed-medium-r-*-*-16-*-*-*-*-*-fontset-song,\
        chinese-gb2312:-misc-simsun-medium-r-*--16-*-*-*-*-*-gb2312*-*,\
        chinese-big5-1:-misc-simsun-medium-r-*--16-*-*-*-*-*-big5*-*,\
        chinese-big5-2:-misc-simsun-medium-r-*--16-*-*-*-*-*-big5*-*,\
        japanese-jisx0208:-misc-simsun-medium-r-*--16-*-*-*-*-*-jis0201*-0,\
        mule-unicode-0100-24ff:-*-fixed-medium-r-normal--16-*-*-*-*-*-iso10646-1,\
        mule-unicode-e000-ffff:-*-fixed-medium-r-normal--16-*-*-*-*-*-iso10646-1,\
        mule-unicode-2500-33ff:-*-fixed-medium-r-normal--16-*-*-*-*-*-iso10646-1,\
        chinese-cns11643-5:-misc-simsun-medium-r-*--16-*-*-*-*-*-gbk-0,\
        chinese-cns11643-6:-misc-simsun-medium-r-*--16-*-*-*-*-*-gbk-0,\
        chinese-cns11643-7:-misc-simsun-medium-r-*--16-*-*-*-*-*-gbk-0

    , then did 
    $ xrdb ~/.Xdefaults

12) Type and read chinese characters using Emacs:
    $ scim
    and, in another console,
    $ LC_CTYPE=zh_CN.UTF-8 emacs
    . I did C-space and the scim toolbar appeared, 
    and I could type simplified and traditional Chinese with scim, 
    together with italian accented characters.

13) # urpmi gedit

14) $ gedit
    , right-clicked in the text area within gedit
    and "SCIM Input Method" was not in the Input Methods sub menu.
    Then I did:
    # gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules.lib
    , then
    $ mozilla
    , C-space, then View -> Character Encoding -> Unicode (UTF-8) 
    and could input Chinese with scim.
    I created an account to gmail and could edit and read e-mails
    containig chinese characters using scim as input method
    and mozilla as web browser.