“语言环境”在Mac OS X和/或其他Unix / Linux操作系统上的作用究竟是什么

man locale

我认为该语言环境显示有关“当前语言环境”的信息或所有可用语言环境的列表.

另外,跑步

$locale

给…

LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

然而,无论是男性还是实际操作它都无法揭示这些环境变量的作用.我想具体问一下这些环境变量需要用于什么? (比如在这个具有这些环境变量的unix / linux操作系统上运行的软件的上下文中)

问题:在具有这些区域设置的操作系统上运行的软件环境中,这意味着什么?

最佳答案
哦,手册页(man 1 locale):

LC_CTYPE
Character classification and case conversion.

LC_COLLATE
Collation 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 interactive responses.

也许,您在错误的部分查找了“区域设置”联机帮助页?这些是标准部分(见男人)

0   Header files (usually found in /usr/include)
1   Executable programs or shell commands
2   System calls (functions provided by the kernel)
3   Library calls (functions within program libraries)
4   Special files (usually found in /dev)
5   File formats and conventions eg /etc/passwd
6   Games
7   Miscellaneous (including macro  packages  and  conven-
    tions),e.g. man(7),groff(7)
8   System administration commands (usually only for root)
9   Kernel routines [Non standard]

因此,对于语言环境二进制文件,您必须查看第1节:man 1语言环境.为了完整回答您的问题,我引用了locale的手册页的描述部分:

DESCRIPTION
   The locale utility shall write information  about  the  current  locale
   environment,or  all  public  locales,to the standard output. For the
   purposes of this section,a public locale is one provided by the imple-
   mentation that is accessible to the application.

   When  locale  is  invoked without any arguments,it shall summarize the
   current locale environment for each locale category  as  determined  by
   the  settings  of the environment variables defined in the Base Defini-
   tions volume of IEEE Std 1003.1-2001,Chapter 7,Locale.

   When invoked with operands,it  shall  write  values  that  have  been
   assigned to the keywords in the locale categories,as follows:

    * Specifying  a  keyword  name  shall select the named keyword and the
      category containing that keyword.

    * Specifying a category name shall select the named category  and  all
      keywords in that category.

样品(LC_TIME和LC_MESSAGES):

$export LC_TIME='fr_FR.UTF-8' #french time
$date
mar. août 30 18:41:07 CEST 2011
$export LC_TIME='de_DE.UTF-8' #german time
$date
Di 30. Aug 18:41:12 CEST 2011 #english time
$export LC_TIME='en_US.UTF-8'
$date
Tue Aug 30 18:41:17 CEST 2011
$rm NON-EXIST
rm: cannot remove `NON-EXIST': No such file or directory
$export LC_TIME='de_DE.UTF-8' #german time,but english MESSAGES
$rm NON-EXIST
rm: cannot remove `NON-EXIST': No such file or directory
$export LC_MESSAGES='de_DE.UTF-8' #german messages
$rm NON-EXIST
rm: cannot remove `NON-EXIST': Datei oder Verzeichnis nicht gefunden

LC_COLLATE用于根据语言对信息进行排序. LC_MONETARY是货币的格式(美国:1.24美元,欧洲:1.24€)

相关文章

文章浏览阅读1.8k次,点赞63次,收藏54次。Linux下的目录权限...
文章浏览阅读1.6k次,点赞44次,收藏38次。关于Qt的安装、Wi...
本文介绍了使用shell脚本编写一个 Hello
文章浏览阅读1.5k次,点赞37次,收藏43次。【Linux】初识Lin...
文章浏览阅读3k次,点赞34次,收藏156次。Linux超详细笔记,...
文章浏览阅读6.8k次,点赞109次,收藏114次。【Linux】 Open...