免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1017 | 回复: 0
打印 上一主题 下一主题

如何改变一台主机的locale [复制链接]

论坛徽章:
2
双鱼座
日期:2014-02-23 12:10:03操作系统版块每日发帖之星
日期:2015-12-17 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-03-19 16:58 |只看该作者 |倒序浏览
Q: 一台SPARC/Solaris 8运行在US locale环境中,现在我们想让它运行在IE(Ireland) locale环境中,以便可以使用欧洲日期格式,怎么办?
A1: 运行sys-unconfig,在此之前请man -s 1M sys-unconfig,:-)
A2: 天啊,为了拍死一只苍蝇,你要引爆原子弹吗?
只需要做如下操作,在你的.cshrc/.profile/.bashrc等启动脚本中设置$LANG环境变量的值为en_UK,注销,重新登录即可。为了使这个设置全局有效,修改/etc/default/init文件,LANG=en_UK,重启动。
--------------------------------------------------------------------------
# @(#)init.dfl 1.2 92/11/26
#
# This file is /etc/default/init.  /etc/TIMEZONE is a symlink to this file.
# This file looks like a shell script, but it is not.  To maintain
# compatibility with old versions of /etc/TIMEZONE, some shell constructs
# (i.e., export commands) are allowed in this file, but are ignored.
#
# Lines of this file should be of the form VAR=value, where VAR is one of
# TZ, LANG, or any of the LC_* environment variables.
#
TZ=GMT+8
LANG=zh.GBK
--------------------------------------------------------------------------
参看locale(1)和locale(5),了解更多关于locale的信息。运行"locale -a",查看当前系统所支持的所有locale。

有三种方式改变locale。首先用"locale -a"命令确认系统中已安装的locale
1) 从CDE登录屏幕上修改locale
选择 options -> languages -> choose the new locale
注意,如果登录用户的初始化文件中有不同的locale设置,将优先于系统全局locale设置。
2) 临时设置locale(shell相关的)
ksh : LANG=
sh  : LANG=
      export LANG
csh : setenv LANG
bash: export LANG=en_US(zh.GBK)
3) vi /etc/default/init
增加如下内容
LANG=
LC_ALL=
重启系统。
运行"locale"命令确认改变生效。
如果你希望使用的locale并未安装,参看如下文档安装locale
Solaris 8  : >
Solaris 7  : >
Solaris 2.6: >

SPARC/Solaris 2.5下,为了在vi中正确看到中文需要设置环境变量
sh
LANG=C;export LANG
LC_CTYPE=iso_8859_1;export LC_CTYPE
csh
setenv LANG zh
关于设置LANG这个环境变量涉及到/usr/lib/locale下的目录权限。

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/524/showart_87759.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP