📄 locale.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2004 IEEE and The Open Group, All Rights Reserved --><title>locale</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="locale"></a> <a name="tag_04_76"></a><!-- locale --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2004 Edition<br>Copyright © 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_04_76_01"></a>NAME</h4><blockquote>locale - get locale-specific information</blockquote><h4><a name="tag_04_76_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt>locale</tt> <b>[</b><tt>-a| -m</tt><b>]</b><tt><br><br>locale</tt> <b>[</b><tt>-ck</tt><b>]</b> <i>name</i><tt>...<br></tt></code></p></blockquote><h4><a name="tag_04_76_03"></a>DESCRIPTION</h4><blockquote><p>The <i>locale</i> utility shall write information about the current locale environment, or all public locales, to the standardoutput. For the purposes of this section, a <i>public locale</i> is one provided by the implementation that is accessible to theapplication.</p><p>When <i>locale</i> is invoked without any arguments, it shall summarize the current locale environment for each locale categoryas determined by the settings of the environment variables defined in the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap07.html">Chapter 7, Locale</a>.</p><p>When invoked with operands, it shall write values that have been assigned to the keywords in the locale categories, asfollows:</p><ul><li><p>Specifying a keyword name shall select the named keyword and the category containing that keyword.</p></li><li><p>Specifying a category name shall select the named category and all keywords in that category.</p></li></ul></blockquote><h4><a name="tag_04_76_04"></a>OPTIONS</h4><blockquote><p>The <i>locale</i> utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>.</p><p>The following options shall be supported:</p><dl compact><dt><b>-a</b></dt><dd>Write information about all available public locales. The available locales shall include <b>POSIX</b>, representing the POSIXlocale. The manner in which the implementation determines what other locales are available is implementation-defined.</dd><dt><b>-c</b></dt><dd>Write the names of selected locale categories; see the STDOUT section. The <b>-c</b> option increases readability when morethan one category is selected (for example, via more than one keyword name or via a category name). It is valid both with andwithout the <b>-k</b> option.</dd><dt><b>-k</b></dt><dd>Write the names and values of selected keywords. The implementation may omit values for some keywords; see the OPERANDSsection.</dd><dt><b>-m</b></dt><dd>Write names of available charmaps; see the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap06.html#tag_06_01">Section 6.1, Portable Character Set</a>.</dd></dl></blockquote><h4><a name="tag_04_76_05"></a>OPERANDS</h4><blockquote><p>The following operand shall be supported:</p><dl compact><dt><i>name</i></dt><dd>The name of a locale category as defined in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap07.html">Chapter 7, Locale</a>, the name of a keyword in a locale category, or the reserved name<b>charmap</b>. The named category or keyword shall be selected for output. If a single <i>name</i> represents both a localecategory name and a keyword name in the current locale, the results are unspecified. Otherwise, both category and keyword names canbe specified as <i>name</i> operands, in any sequence. It is implementation-defined whether any keyword values are written for thecategories <i>LC_CTYPE</i> and <i>LC_COLLATE .</i></dd></dl></blockquote><h4><a name="tag_04_76_06"></a>STDIN</h4><blockquote><p>Not used.</p></blockquote><h4><a name="tag_04_76_07"></a>INPUT FILES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_76_08"></a>ENVIRONMENT VARIABLES</h4><blockquote><p>The following environment variables shall affect the execution of <i>locale</i>:</p><dl compact><dt><i>LANG</i></dt><dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> forthe precedence of internationalization variables used to determine the values of locale categories.)</dd><dt><i>LC_ALL</i></dt><dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd><dt><i>LC_CTYPE</i></dt><dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte asopposed to multi-byte characters in arguments and input files).</dd><dt><i>LC_MESSAGES</i></dt><dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standarderror.</dd><dt><i>NLSPATH</i></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i> <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd></dl><p>The application shall ensure that the <i>LANG ,</i> <i>LC_* ,</i> and <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup><img src="../images/opt-start.gif" alt="[Option Start]" border="0"> <i>NLSPATH</i> <img src="../images/opt-end.gif" alt="[Option End]" border="0"> environment variables specify the current locale environment to be written out; they shall be usedif the <b>-a</b> option is not specified.</p></blockquote><h4><a name="tag_04_76_09"></a>ASYNCHRONOUS EVENTS</h4><blockquote><p>Default.</p></blockquote><h4><a name="tag_04_76_10"></a>STDOUT</h4><blockquote><p>If <i>locale</i> is invoked without any options or operands, the names and values of the <i>LANG</i> and <i>LC_*</i> environmentvariables described in this volume of IEEE Std 1003.1-2001 shall be written to the standard output, one variable perline, with <i>LANG</i> first, and each line using the following format. Only those variables set in the environment and notoverridden by <i>LC_ALL</i> shall be written using this format:</p><pre><tt>"%s=%s\n", <</tt><i>variable_name</i><tt>>, <</tt><i>value</i><tt>></tt></pre><p>The names of those <i>LC_*</i> variables associated with locale categories defined in this volume ofIEEE Std 1003.1-2001 that are not set in the environment or are overridden by <i>LC_ALL</i> shall be written in thefollowing format:</p><pre><tt>"%s=\"%s\"\n", <</tt><i>variable_name</i><tt>>, <</tt><i>implied value</i><tt>></tt></pre><p>The <<i>implied value</i>> shall be the name of the locale that has been selected for that category by theimplementation, based on the values in <i>LANG</i> and <i>LC_ALL ,</i> as described in the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html">Chapter 8, Environment Variables</a>.</p><p>The <<i>value</i>> and <<i>implied value</i>> shown above shall be properly quoted for possible later reentryto the shell. The <<i>value</i>> shall not be quoted using double-quotes (so that it can be distinguished by the user fromthe <<i>implied value</i>> case, which always requires double-quotes).</p><p>The <i>LC_ALL</i> variable shall be written last, using the first format shown above. If it is not set, it shall be writtenas:</p><pre><tt>"LC_ALL=\n"</tt></pre><p>If any arguments are specified:</p><ol><li><p>If the <b>-a</b> option is specified, the names of all the public locales shall be written, each in the following format:</p><pre><tt>"%s\n", <</tt><i>locale name</i><tt>></tt></pre></li><li><p>If the <b>-c</b> option is specified, the names of all selected categories shall be written, each in the following format:</p><pre><tt>"%s\n", <</tt><i>category name</i><tt>></tt></pre><p>If keywords are also selected for writing (see following items), the category name output shall precede the keyword output forthat category.</p><p>If the <b>-c</b> option is not specified, the names of the categories shall not be written; only the keywords, as selected bythe <<i>name</i>> operand, shall be written.</p></li><li><p>If the <b>-k</b> option is specified, the names and values of selected keywords shall be written. If a value is non-numeric, it
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -