Linux下“英文控制台 中文图形界面”的实现

以Slackware12.2为例:

      首先安装好slackware12.2,装好后敲入startx,进入图形界面。第一次登录图形界面时会提示你是哪国人(查下户口先^_^),坚定的选择中国,默认语言就是简体中文,确定后就进入了全中文图形界面。然而进去后就看到很不舒服的中文,看到的中文界面词组基本都是缺胳膊少腿的,必须要从头设置了。

     打开终端(鼠标右键点运行,输入konsole,就出来了),输入locale来看看语言设置,我的结果如下:
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

 

意义如下:
 1、语言符号及其分类(LC_CTYPE)
2、数字(LC_NUMERIC)
3、比较和排序习惯(LC_COLLATE)
4、时间显示格式(LC_TIME)
5、货币单位(LC_MONETARY)
6、信息主要是提示信息,错误信息,状态信息,标题,标签,按钮和菜单等(LC_MESSAGES)
7、姓名书写方式(LC_NAME)
8、地址书写方式(LC_ADDRESS)
9、电话号码书写方式(LC_TELEPHONE)
10、度量衡表达方式 (LC_MEASUREMENT)
11、默认纸张尺寸大小(LC_PAPER)
12、对locale自身包含信息的概述(LC_IDENTIFICATION)
 
下边的设置都是对/etc/profile.d/lang.sh的改动,改动前将文件中都注释掉(加#,可别习惯加//^_^):

一).如果你需要一个纯中文的GUI的话,写入LC_ALL=zh_CN.UTF-8,或者LANG=zh_CN.UTF-8都可以。那12个LC_**不写。
二).如果你也和我一样想要英文CLI,中文GUI,那么就写入LC_CTYPE=zh_CN.UTF-8,LANG=en_US.UTF-8就可以了。其他的不写。
三).假如你高兴的话,可以把12个LC_**一一设定成你需要的值,打造一个古灵精怪的系统: LC_CTYPE=zh_CN.GBK/GBK(使用中文编码内码GBK字符集); LC_NUMERIC=en_GB.ISO-8859-1(使用大不列颠的数字系统) [email protected](德国的度量衡使用ISO-8859-15字符集) 罗马的地址书写方式,美国的纸张设定……。估计没人这么干吧- -!

下边是我改动前的lang.sh:

 #!/bin/sh # Set the system locale. (no, we don't have a menu for this ;-) # For a list of locales which are supported by this machine, type: # locale -a # en_US is the Slackware default locale: export LANG=en_US # 'C' is the old Slackware (and UNIX) default, which is 127-bit # ASCII with a charmap setting of ANSI_X3.4-1968. These days, # it's better to use en_US or another modern $LANG setting to # support extended character sets. #export LANG=C # There is also support for UTF-8 locales, but be aware that # some programs are not yet able to handle UTF-8 and will fail to # run properly. In those cases, you can set LANG=C before # starting them. Still, I'd avoid UTF unless you actually need it. #export LANG=en_US.UTF-8 # Another option for en_US: #export LANG=en_US.ISO8859-1 # One side effect of the newer locales is that the sort order # is no longer according to ASCII values, so the sort order will # change in many places. Since this isn't usually expected and # can break scripts, we'll stick with traditional ASCII sorting. # If you'd prefer the sort algorithm that goes with your $LANG # setting, comment this out. export LC_COLLATE=C # End of /etc/profile.d/lang.sh

这个是我设置后的lang.sh:

 

#!/bin/sh # Set the system locale. (no, we don't have a menu for this ;-) # For a list of locales which are supported by this machine, type: # locale -a # en_US is the Slackware default locale: # export LANG=en_US export LC_CTYPE=zh_CN.UTF-8 export LANG=en_US.UTF-8 # 'C' is the old Slackware (and UNIX) default, which is 127-bit # ASCII with a charmap setting of ANSI_X3.4-1968. These days, # it's better to use en_US or another modern $LANG setting to # support extended character sets. #export LANG=C # There is also support for UTF-8 locales, but be aware that # some programs are not yet able to handle UTF-8 and will fail to # run properly. In those cases, you can set LANG=C before # starting them. Still, I'd avoid UTF unless you actually need it. #export LANG=en_US.UTF-8 # Another option for en_US: #export LANG=en_US.ISO8859-1 # One side effect of the newer locales is that the sort order # is no longer according to ASCII values, so the sort order will # change in many places. Since this isn't usually expected and # can break scripts, we'll stick with traditional ASCII sorting. # If you'd prefer the sort algorithm that goes with your $LANG # setting, comment this out. # export LC_COLLATE=C # End of /etc/profile.d/lang.sh

如果想知道更多的LC_**知识,请去 http://hi.baidu.com/edeed/blog/item/2e99a14440bd8884b2b7dcb1.html看看。

 

至于其他的linux发行版,我想原理应该差不多,大家研究研究吧。与君共勉!!

 

 

你可能感兴趣的:(我最喜爱的Linux)