Solaris设置locale

Locale 简单说就是一组「地区语言」的资讯。它包括了
LC_CTYPE: 字符定义
LC_MESSAGES: 讯息显示
LC_TIME: 时间显示格式
LC_NUMERIC: 数字显示格式
LC_MONETARY: 货币显示格式
LC_COLLATE: 字母顺序与字符串比较
其中,与一般使用者最有关系的,是 LC_CTYPE 与 LC_MESSAGES 。
LC_CTYPE 直接关系到某些字符或内码在目前的locale下是否可印? 要如何转换? 对应到那一个字? .... 等等。
LC_MESSAGES 则关系到软体的讯息输出是什么样的语文。真正完整的locale支持,是当我们在shell prompt下,直接设好环境变数,则我们马上就能切换到那个语言。
以上文字由Linux红联社区翻译自:IBM

Solaris Locale的设置方法如下

查看当前locale状态:
# locale
LANG=en_US
LC_CTYPE= "en_US"
LC_NUMERIC= "en_US"
LC_TIME= "en_US"
LC_COLLATE= "en_US"
LC_MONETARY= "en_US"
LC_MESSAGES= "en_US"
LC_ALL=en_US

查看系统中已安装的语言包:
# locale -a

用户自定义locale:
sh, ksh, bash:
# LANG=C; export LANG
# LC_ALL=C; export LC_ALL

csh:
# setenv LANG C
# setenv LC_ALL

或者编辑环境文件,只对当前用户有效:
$HOME/.profile or $HOME/.cshrc   

更改系统默认的locale, 修改文件:
vi /etc/default/init

example:
# 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.
LANG=C
LC_ALL=C

 

附录:

You can change your system locale on UNIX and Linux systems.
You can set environment variables to control the system locale. You can set these variables to be system-wide, or on a per-session basis:

LC_ALL
    Overrides all LC_* environment variables with the given value
LC_CTYPE
    Character classification and case conversion
LC_COLLATE
    Collation (sort) order
LC_TIME
    Date and time formats
LC_NUMERIC
    Non-monetary numeric formats
LC_MONETARY
    Monetary formats
LC_MESSAGES
    Formats of informative and diagnostic messages, and of interactive responses
LC_PAPER
    Paper size
LC_NAME
    Name formats
LC_ADDRESS
    Address formats and location information
LC_TELEPHONE
    Telephone number formats
LC_MEASUREMENT
    Measurement units (Metric or Other)
LC_IDENTIFICATION
    Metadata about the locale information
LANG
    The default value, which is used when either LC_ALL is not set, or an applicable value for LC_* is not set
NLSPATH
    Delimited list of paths to search for message catalogs
TZ
    Time zone

  LC_MESSAGES and NLSPATH are the most important variables to the broker. These variables define the language and location of response messages that the broker uses. The broker profile file, mqsiprofile, sets NLSPATH. Either you, or your system must set LC_MESSAGES. The value set in LC_MESSAGES must be a value that the broker recognizes. LC_CTYPE is also important to the broker because it defines the character conversion that the broker performs when interacting with the local environment.
   If you use common desktop environment (CDE), use this environment to set the locale instead of setting LANG and LC_ALL directly. The NLSPATH variable respects either method. Before setting the code page, check that it is one of the Supported code pages.
For example, to set WebSphere® Message Broker to run in a UTF-8 environment set the following values in the profile:
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
Where en_US sets the language, and utf-8 sets the code page.

 

From:baiduHi

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值