QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1303|回复: 7

英文local下输入中文之scim

[复制链接]
发表于 2004-5-22 14:45:02 | 显示全部楼层 |阅读模式
英文local下输入中文之scim

我在FC1下一直用scim,它的确是一个非常好用的输入法。转到FC2后,以前的安装方法已经不起作用了,经过多次摸索,终于在FC2下安装成功。
首先,安装中文字体(不用多说了吧,已经有很多文章讨论过了。)
然后到以下网址下载scim:  http://www.freedesktop.org/~suzhe/download.html
只需两个文件:scim-0.9.7-1.i586.rpm和scim-chinese-0.3.0-1.i586.rpm
如果你想用五笔、仓颉等输入法可以下载scim-tables-zh-0.3.5-1.i586.rpm装上。
接下来主要需要修改一个文件/etc/X11/xinit/xinit/xinitrc.d/xinput
修改后文件内容如下:
#!/bin/bash
# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
# copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the
# GNU General Public License version 2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# XIM( X Input Method ) script
#
# Original Korean support contributed by:
#        Won-kyu Park <[email protected]>
#

oldterm=$TERM
unset TERM
# Load up the user and system locale settings
if [ -r /etc/profile.d/lang.sh ]; then
  . /etc/profile.d/lang.sh
fi
export TERM=$oldterm

tmplang="en_US"
#if test x$GDM_LANG != x ; then
#    tmplang=$GDM_LANG
if [ -n "$LC_ALL" ]; then
    tmplang=$LC_ALL
elif [ -n "$LC_CTYPE" ]; then
    tmplang=$LC_CTYPE
elif [ -n "$LANG" ]; then
    tmplang=$LANG
elif [ -r /etc/sysconfig/i18n ]; then
    . /etc/sysconfig/i18n
    tmplang=$LANG
fi

#
# check to see if the user has a preferred desktop
#

PREFERRED=

# runlevel 5 - checks which session manager it will load
# runlevel 3 - checks which desktop manager it will load
if [ -f /etc/sysconfig/desktop ]; then
# WARNING: This grep regex can be combined when someone has copious spare time.
if grep -q "GNOME" /etc/sysconfig/desktop 2>/dev/null || grep -q "\"\"" /etc/sysconfig/desktop 2>/dev/null; then
         # runlevel 5 with gdm - checks for $GDMSESSION and set the $PREFERRED
         if [ "$GDMSESSION" = "Default" ]; then
                 PREFERRED=gnome
         elif [ "$GDMSESSION" = "GNOME" ]; then
                 PREFERRED=gnome
         elif [ "$GDMSESSION" = "KDE" ]; then
                 PREFERRED=kde
         else
                 # applies if no env and runlevel 3
                 PREFERRED=gnome
         fi
elif grep -q "KDE" /etc/sysconfig/desktop 2>/dev/null; then

        if [ -z $1 -o "$1" = "default" ]; then
                 # applies if no arg passed by kdm and runlevel 3
                 PREFERRED=kde
        else
                 # otherwise assign $PREFERRED from arg
                 PREFERRED=$1
        fi
fi
fi

if [ -z "$PREFERRED" ]; then

        GSESSION=gnome-session
        STARTKDE=startkde

        # by default, we run GNOME.
        if which "$GSESSION" > /dev/null 2>&1; then
                PREFERRED=gnome
        fi

        # if GNOME isn't installed, try KDE.
        if which "$STARTKDE" > /dev/null 2>&1; then
                PREFERRED=kde
        fi
fi


#
# check $XIM and set a default $XIM value.
#

# default to iiim if htt server is running
if [ -z "$XIM" ]; then
    case $tmplang in ( ar* | be* | ja* | ko* | th* | zh* | *_IN* )
        if /sbin/service IIim status 2>/dev/null | /bin/grep -q pid ; then
          XIM=htt
        fi
        ;;
    esac

fi

# otherwise revert to legacy XIM client
if [ -z "$XIM" ]; then
    case $tmplang in
        ja*)
# WARNING: This binary should be in /usr/bin, not in /usr/X11R6/bin, because
# /usr/X11R6/bin is strictly for software supplied as an official part of
# X11R6, not for random applications to drop files in.
            if [ -x /usr/X11R6/bin/xwnmo ]; then
                    XIM="_XWNMO"
            elif [ -x /usr/bin/uim-xim ]; then
                    XIM="uim"
# WARNING: This binary should be in /usr/bin, not in /usr/X11R6/bin, because
# /usr/X11R6/bin is strictly for software supplied as an official part of
# X11R6, not for random applications to drop files in.
            elif [ -x /usr/X11R6/bin/kinput2 ]; then
                    XIM="kinput2"
# WARNING: This binary should be in /usr/bin, not in /usr/X11R6/bin, because
# /usr/X11R6/bin is strictly for software supplied as an official part of
# X11R6, not for random applications to drop files in.
            elif [ -x /usr/X11R6/bin/skkinput ]; then
                    XIM="skkinput"
            fi
        ;;
        ko*)
            if [ -x /usr/bin/nabi ]; then
                    XIM="nabi"
            elif [ -x /usr/bin/ami ]; then
                    XIM="Ami"
            elif [ -x /usr/bin/hanIM ]; then
                    XIM="hanIM"
            fi
        ;;
        zh_CN*)
            if [ -x /usr/bin/chinput ]; then
                XIM="Chinput"
            fi
        ;;
        zh_TW*)
# WARNING: This binary should be in /usr/bin, not in /usr/X11R6/bin, because
# /usr/X11R6/bin is strictly for software supplied as an official part of
# X11R6, not for random applications to drop files in.
            if [ -x /usr/X11R6/bin/xcin ]; then
                XIM="xcin"
            fi
        ;;
        en_US*)
            if [ -x /usr/bin/scim ]; then
                XIM="SCIM"
            fi
        ;;
    esac
fi

#
# set a proper XIM program with respect to $XIM
#
if [ -z "$XIM_PROGRAM" ]; then
   case "$XIM" in
      Ami)
        case "$PREFERRED" in
           kde)
                if which wmami >/dev/null 2>&1 ; then
                        XIM_PROGRAM=wmami
                        XIM_ARGS="-wait"
                elif which ami >/dev/null 2>&1 ; then
                        XIM_PROGRAM=ami
                fi
                ;;
           *)
                if which ami >/dev/null 2>&1 ; then
                        XIM_PROGRAM=ami
                fi
                ;;
        esac
        ;;
      Chinput)
        XIM_PROGRAM=chinput
        ;;
      hanIM)
        if which hanIM >/dev/null 2>&1 ; then
                XIM_PROGRAM=hanIM
        fi
        ;;
      htt)
        XIM_PROGRAM=httx
        ;;
      kinput2)
        XIM_PROGRAM=kinput2
        if [ -z "$XIM_ARGS" ]; then
            if /usr/bin/cannaping 2>/dev/null ; then
                XIM_ARGS="-canna +kinput -xim"
            elif /sbin/service FreeWnn status 2>/dev/null | /bin/grep -q pid
            then
                XIM_ARGS="-wnn +kinput -xim"
            else
                XIM_ARGS="+kinput -xim"
            fi
        fi
        ;;
      nabi)
        XIM_PROGRAM=nabi
        ;;
      skkinput)
        XIM_PROGRAM=skkinput
        ;;
      uim)
        XIM_PROGRAM=uim-xim
        ;;
      _XWNMO)
        XIM_PROGRAM=xwnmo
        ;;
      xcin)
        XIM_PROGRAM=xcin
        XIM_ARGS="-x xcin"
        ;;
      SCIM)
        XIM_PROGRAM=scim
        XIM_ARGS="-d"
        ;;
   esac
fi

# set default gtk IM module
if [ -z "$GTK_IM_MODULE" ]; then
   case "$XIM" in
      htt)
        GTK_IM_MODULE=iiim
         ;;
      SCIM)
        GTK_IM_MODULE=xim
         ;;
   esac
fi
[ -n "$GTK_IM_MODULE" ] && export GTK_IM_MODULE

# setup XMODIFIERS
[ -z "$XMODIFIERS" -a -n "$XIM" ] && export XMODIFIERS="@im=$XIM"

# execute XIM_PROGRAM
which "$XIM_PROGRAM" > /dev/null 2>&1 && LANG="$tmplang" "$XIM_PROGRAM" $XIM_ARGS &

还有一个文件/etc/gtk-2.0/gtk.immodules,这个文件中的很多输入法模块都没用(你在输入文字的地方点右键,会看到Input methods),除了xim模块外全部注释掉(我把它们全删了,省事、方便)。
# GTK+ Input Method Modules file
# Automatically generated file, do not edit
#
# ModulesPath = /root/.gtk-2.0/2.4.0/i386-redhat-linux-gnu/immodules:/root/.gtk-2.0/2.4.0/immodules:/root/.gtk-2.0/i386-redhat-linux-gnu/immodules:/root/.gtk-2.0/immodules:/usr/lib/gtk-2.0/2.4.0/i386-redhat-linux-gnu/immodules:/usr/lib/gtk-2.0/2.4.0/immodules:/usr/lib/gtk-2.0/i386-redhat-linux-gnu/immodules:/usr/lib/gtk-2.0/immodules
#
"/usr/lib/gtk-2.0/2.4.0/immodules/im-xim.so"
"xim" "X Input Method" "gtk20" "/usr/share/locale" "ko:ja:zh"

好了,全部完成,注消一下,scim就可以用了。
不知为甚么,我注消第一次后输入法不能用,注消第二次后才可以。如果你有类似问题,可以试试。
发表于 2004-5-22 16:24:08 | 显示全部楼层
I followed what you said.
It didn't work.

I don't change anything.
Just install scim, scim-chinese, scim-tables-zh, and modify xinput.

My locale is en_US.UTF-8.
Did you change you LC_CTYPE?
回复

使用道具 举报

 楼主| 发表于 2004-5-22 17:01:21 | 显示全部楼层
试一试在以下网址下载scim-chinese-0.2.7-1.i586.rpm
http://www.turbolinux.com.cn/~suzhe/scim/download.html#
3.0的scim-chinese有问题。
我没有改变LC_CTYPE,一切都是按照刚安装时的设置。
回复

使用道具 举报

发表于 2004-5-22 21:00:34 | 显示全部楼层
我之前装的是0.2.7,看了你的帖子后装的是0.3
还是不行,也不知少了什么,现在只好在windows下输中文
回复

使用道具 举报

 楼主| 发表于 2004-5-23 11:45:10 | 显示全部楼层
http://linuxfans.org/nuke/modules.php?name=Desktop_Downloads&op=geninfo&did=953
回复

使用道具 举报

发表于 2004-5-23 13:11:01 | 显示全部楼层
是什么东东
地址好像有问题,连接不上
回复

使用道具 举报

发表于 2004-11-15 22:11:48 | 显示全部楼层
scim和emacs有冲突?
我在英文 local 下可以启动scim,但是输入汉字按空格后
在emacs中显示乱码,我的.emacs已经培植好了,在console
下可以显示和输入中文,启用chinput后也可在emacs中输入
中文,请问是不是两者之间有冲突?应该怎么解决?盼复!!!!!!!!!!!!!!!!!!
              
回复

使用道具 举报

发表于 2005-1-6 13:37:57 | 显示全部楼层
上面的地址下载不了.
请问如何用源码编译安装scim及chinese输入法?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-8 00:40 , Processed in 0.042421 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表