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

Cal*_*eng 5 linux macos locale

man locale
Run Code Online (Sandbox Code Playgroud)

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

另外,跑步

$ locale
Run Code Online (Sandbox Code Playgroud)

给...

LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
Run Code Online (Sandbox Code Playgroud)

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

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

Joh*_*iss 5

哦,手册页 ( man 1 locale) 做了:

\n\n
LC_CTYPE\nCharacter classification and case conversion.\n\nLC_COLLATE\nCollation order.\n\nLC_TIME\nDate and time formats.\n\nLC_NUMERIC\nNon-monetary numeric formats.\n\nLC_MONETARY\nMonetary formats.\n\nLC_MESSAGES\nFormats of informative and diagnostic messages and interactive responses.\n
Run Code Online (Sandbox Code Playgroud)\n\n

也许您在错误的部分中查找了“locale”联机帮助页?这些是标准部分(请参阅man man

\n\n
0   Header files (usually found in /usr/include)\n1   Executable programs or shell commands\n2   System calls (functions provided by the kernel)\n3   Library calls (functions within program libraries)\n4   Special files (usually found in /dev)\n5   File formats and conventions eg /etc/passwd\n6   Games\n7   Miscellaneous (including macro  packages  and  conven-\n    tions), e.g. man(7), groff(7)\n8   System administration commands (usually only for root)\n9   Kernel routines [Non standard]\n
Run Code Online (Sandbox Code Playgroud)\n\n

因此,对于locale二进制文件,您必须查看1:部分man 1 locale。为了完全回答你的问题,我引用了 locale 手册页的描述部分:

\n\n
DESCRIPTION\n   The locale utility shall write information  about  the  current  locale\n   environment,  or  all  public  locales, to the standard output. For the\n   purposes of this section, a public locale is one provided by the imple-\n   mentation that is accessible to the application.\n\n   When  locale  is  invoked without any arguments, it shall summarize the\n   current locale environment for each locale category  as  determined  by\n   the  settings  of the environment variables defined in the Base Defini-\n   tions volume of IEEE Std 1003.1-2001, Chapter 7, Locale.\n\n   When invoked with operands,  it  shall  write  values  that  have  been\n   assigned to the keywords in the locale categories, as follows:\n\n    * Specifying  a  keyword  name  shall select the named keyword and the\n      category containing that keyword.\n\n    * Specifying a category name shall select the named category  and  all\n      keywords in that category.\n
Run Code Online (Sandbox Code Playgroud)\n\n

样本 (LC_TIMELC_MESSAGES):

\n\n
$ export LC_TIME=\'fr_FR.UTF-8\' #french time\n$ date\nmar. ao\xc3\xbbt 30 18:41:07 CEST 2011\n$ export LC_TIME=\'de_DE.UTF-8\' #german time\n$ date\nDi 30. Aug 18:41:12 CEST 2011 #english time\n$ export LC_TIME=\'en_US.UTF-8\'\n$ date\nTue Aug 30 18:41:17 CEST 2011\n$ rm NON-EXIST\nrm: cannot remove `NON-EXIST\': No such file or directory\n$ export LC_TIME=\'de_DE.UTF-8\' #german time, but english MESSAGES\n$ rm NON-EXIST\nrm: cannot remove `NON-EXIST\': No such file or directory\n$ export LC_MESSAGES=\'de_DE.UTF-8\' #german messages\n$ rm NON-EXIST\nrm: cannot remove `NON-EXIST\': Datei oder Verzeichnis nicht gefunden\n
Run Code Online (Sandbox Code Playgroud)\n\n

LC_COLLATE用于根据语言对信息进行排序。LC_MONETARY是货币格式(美国:$1.24,欧洲:1.24 \xe2\x82\xac

\n