首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Mac和/或其他Unix/Linux操作系统上,"locale“到底是做什么的?

问在Mac和/或其他Unix/Linux操作系统上,"locale“到底是做什么的?
EN

Stack Overflow用户
提问于 2011-08-30 16:31:17
回答 2查看 2.7K关注 0票数 6

阅读

代码语言:javascript
复制
man locale

我认为该区域设置显示有关“当前区域设置”或所有可用区域设置的列表的信息。

此外,运行

代码语言:javascript
复制
$ locale

给..。

代码语言:javascript
复制
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

然而,无论是人还是运行它,实际上都不能说明这些环境变量的作用。我想特别问一下,这些环境变量是所需要的还是所使用的(例如,在这个具有这些环境变量的unix/linux操作系统上运行的软件中)

的问题:,这在运行在操作系统上的软件的上下文中意味着什么?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-08-30 16:34:48

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

代码语言:javascript
复制
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.

也许,您在错误的部分查看了“locale”手册?这些是标准部分(请参阅man man)。

代码语言:javascript
复制
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]

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

代码语言:javascript
复制
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):

代码语言:javascript
复制
$ 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 €)

票数 4
EN

Stack Overflow用户

发布于 2011-08-30 16:35:29

地区管理了很多事情,例如:

正在使用的encoding)

  • Translation

  • 编码(即en_US.UTF-8或其他用于标准库或其他applications.

  • Internationalization (数字格式、货币、日期)的en_US.UTF-8文件)

C区域设置是“默认”区域设置。通常情况下,应该更具体一些,并以在Linux上启用的UTF-8的形式运行。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7246589

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档