以前发现export LANG=zh_CN.UTF-8不生效,一直不知道原因,直到在安装fontconfig时看到如下注释:
As a user, if your language has been installed for this package, you
only have to set the 'LANG' environment variable to the appropriate
'LL_CC' combination. If you happen to have the 'LC_ALL' or some other
'LC_xxx' environment variables set, you should unset them before setting
'LANG', otherwise the setting of 'LANG' will not have the desired
effect. Here 'LL' is an ISO 639 two-letter language code, and 'CC' is
an ISO 3166 two-letter country code. For example, let's suppose that
you speak German and live in Germany. At the shell prompt, merely
execute 'setenv LANG de_DE' (in 'csh'), 'export LANG; LANG=de_DE' (in
'sh') or 'export LANG=de_DE' (in 'bash'). This can be done from your
'.login' or '.profile' file, once and for all.You might think that the country code specification is redundant.
But in fact, some languages have dialects in different countries. For
example, 'de_AT' is used for Austria, and 'pt_BR' for Brazil. The
country code serves to distinguish the dialects.The locale naming convention of 'LL_CC', with 'LL' denoting the
language and 'CC' denoting the country, is the one use on systems based
on GNU libc. On other systems, some variations of this scheme are used,
such as 'LL' or 'LL_CC.ENCODING'. You can get the list of locales
supported by your system for your language by running the command
'locale -a | grep '^LL''.
也就说说如果export LANG时不生效,要么是设置了LC_ALL或者LC_XXX环境变量覆盖了LANG变量,要么是使用的shell不支持export方式