LANG和LANGUAGE的区别

来源:互联网 发布:广告机控制软件 编辑:程序博客网 时间:2024/05/16 19:52
 区别在于:
LANGUAGE是设置应用程序的界面语言。
而LANG是优先级很低的一个变量,它指定所有与locale有关的变量的默认值,
例如如果LC_MESSAGE没有被用户设置,则LC_MESSAGE的取值由LANG确定。
LANG的值由用户选择的默认locale决定 ,例如你的默认locale是zh_CN.UTF-8,
则LANG=zh_CN.UTF-8

Installing the locales package

In Debian, locales is a seperate package from glibc, so you'll have toinstall it in order to generate and use the Japanese locale in Liunx.During installation, debconf will ask you to choose which locales togenerate. For starters, pick ja_JP.EUC-JP and en_US. You may also wantto choose en_US.UTF-8 and ja_JP.UTF-8 for unicode support.

After installation, you can choose and generate locales manually byediting /etc/locale.gen. The contents of mine are as follows:
# This file lists locales that you wish to have built. You can find a list
# of valid supported locales at /usr/share/doc/locales/SUPPORTED.gz. Other
# combinations are possible, but may not be well tested. If you change
# this file, you need to rerun locale-gen.

en_US ISO-8859-1
en_US.UTF-8 UTF-8
ja_JP.EUC-JP EUC-JP
ja_JP.UTF-8 UTF-8
After editing the file, run locale-gen as root.
Setting up the environment

There are several special environment variables that determine how various locale-specific tasks should be handled.
LANG - Specifies the default locale for all unset locale variables
LANGUAGE - Most programs use this for the language of its interface
LINGUAS - (Obsolete?) The WindowMaker window manager used to use this instead of LANGUAGE.
LC_ALL - Overrides the locale for all LC_ variables and LANG
LC_CTYPE - Character handling functions
LC_COLLATE - Affects glob bracket ranges and sort order
LC_MESSAGES - Language that messages should be written in. Most programs use the value of LANGUAGE instead.
LC_NUMERIC - Determines the thousands seperator and how to write floating point numbers
LC_TIME - How to format dates and times
To run X with an English interface but the ability to display, input,and copy-paste Japanese text, set the environment variables as followsprior to running X or in your .Xsession file. These examples assumeyour are running a Bourne-like shell, such as sh, bash, or zsh:
export LANGUAGE=en
export LINGUAS=en
export LC_CTYPE=ja_JP # May break certain things like window maker; untested
export LC_TIME=C # Format time as English
export LC_NUMERIC=C # Format numbers as English
export LC_MESSAGES=C # Output messages in English
export LC_COLLATE=ja_JP # Do sorting and collating of characters as Japanese
export LANG=ja_JP # Use Japanese for all others
If you are using a c-shell like csh or tcsh, use the following instead:
setenv LANGUAGE en
setenv LINGUAS en
setenv LC_CTYPE ja_JP
setenv LC_TIME C
setenv LC_NUMERIC C
setenv LC_MESSAGES C
setenv LC_COLLATE ja_JP
setenv LANG ja_JP
原创粉丝点击