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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章