⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class.locale.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>The Locale class</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="numberformatter.settextattribute.html">NumberFormatter::setTextAttribute</a></div> <div class="next" style="text-align: right; float: right;"><a href="locale.acceptfromhttp.html">Locale::acceptFromHttp</a></div> <div class="up"><a href="book.intl.html">intl</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div> <h1 class="title">The Locale class</h1>  <div class="partintro">    <div id="locale.intro" class="section">   <h2 class="title">Introduction</h2>   <p class="simpara">    A &quot;Locale&quot; is an identifier used to get language, culture, or    regionally-specific behavior from an API. PHP locales are organized and    identified the same way that the CLDR locales used by ICU (and many    vendors of Unix-like operating systems, the Mac, Java, and so forth) use.    Locales are identified using RFC 4646 language tags (which use hyphen, not    underscore) in addition to the more traditional underscore-using    identifiers. Unless otherwise noted the functions in this class are    tolerant of both formats.   </p>   <p class="para">    Examples of identifiers include:    <ul class="simplelist">     <li class="member">en-US (English, United States)</li>     <li class="member">zh-Hant-TW (Chinese, Traditional Script, Taiwan)</li>     <li class="member">fr-CA, fr-FR (French for Canada and France respectively)</li>    </ul>   </p>   <p class="simpara">    The Locale class (and related procedural functions) are used to interact    with locale identifiers--to verify that an ID is well-formed, valid, etc.    The extensions used by CLDR in UAX #35 (and inherited by ICU) are valid    and used wherever they would be in ICU normally.   </p>   <p class="simpara">    Locales cannot be instantiated as objects. All of the functions/methods    provided are static.   </p>   <p class="simpara">    The null or empty string obtains the &quot;root&quot; locale. The &quot;root&quot; locale is    equivalent to &quot;en_US_POSIX&quot; in CLDR. Language tags (and thus locale    identifiers) are case insensitive. There exists a canonicalization    function to make case match the specification.   </p>  </div>    <div id="locale.synopsis" class="section">   <h2 class="title">Class synopsis</h2>      <div class="classsynopsis">    <div class="ooclass">     <b class="classname">Locale</b>    </div>        <div class="classsynopsisinfo">     <span class="ooclass">      <b class="classname">Locale</b>     </span>     {</div>            <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div>    <div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">string</span>    <span class="methodname"><b><a href="locale.acceptfromhttp.html" class="function">Locale::acceptFromHttp</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$header</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">string</span>    <span class="methodname"><b><a href="locale.composelocale.html" class="function">Locale::composeLocale</a></b></span>    ( <span class="methodparam"><span class="type">array</span> <tt class="parameter">$subtags</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">boolean</span>    <span class="methodname"><b><a href="locale.filtermatches.html" class="function">Locale::filterMatches</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$langtag</tt></span>   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">array</span>    <span class="methodname"><b><a href="locale.getallvariants.html" class="function">Locale::getAllVariants</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">string</span>    <span class="methodname"><b><a href="locale.getdefault.html" class="function">Locale::getDefault</a></b></span>    ( <span class="methodparam">void</span>   )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">string</span>    <span class="methodname"><b><a href="locale.getdisplaylanguage.html" class="function">Locale::getDisplayLanguage</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$in_locale</tt></span>  ] )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">string</span>    <span class="methodname"><b><a href="locale.getdisplayname.html" class="function">Locale::getDisplayName</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$in_locale</tt></span>  ] )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">string</span>    <span class="methodname"><b><a href="locale.getdisplayregion.html" class="function">Locale::getDisplayRegion</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$in_locale</tt></span>  ] )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">string</span>    <span class="methodname"><b><a href="locale.getdisplayscript.html" class="function">Locale::getDisplayScript</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$in_locale</tt></span>  ] )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">string</span>    <span class="methodname"><b><a href="locale.getdisplayvariant.html" class="function">Locale::getDisplayVariant</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$in_locale</tt></span>  ] )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">array</span>    <span class="methodname"><b><a href="locale.getkeywords.html" class="function">Locale::getKeywords</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">string</span>    <span class="methodname"><b><a href="locale.getprimarylanguage.html" class="function">Locale::getPrimaryLanguage</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">string</span>    <span class="methodname"><b><a href="locale.getregion.html" class="function">Locale::getRegion</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">string</span>    <span class="methodname"><b><a href="locale.getscript.html" class="function">Locale::getScript</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">string</span>    <span class="methodname"><b><a href="locale.lookup.html" class="function">Locale::lookup</a></b></span>    ( <span class="methodparam"><span class="type">array</span> <tt class="parameter">$langtag</tt></span>   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$default</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">array</span>    <span class="methodname"><b><a href="locale.parselocale.html" class="function">Locale::parseLocale</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">boolean</span>    <span class="methodname"><b><a href="locale.setdefault.html" class="function">Locale::setDefault</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$locale</tt></span>   )</div>   }</div>     </div>    <div id="intl.locale-constants" class="section"> <h2 class="title">Predefined Constants</h2> <p class="para">  These constants define how the Locale  <dl>   <dt>    <span class="term">     <b><tt>Locale::DEFAULT_LOCALE</tt></b>     (<a href="language.types.string.html" class="type string">string</a>)    </span>    <dd>     <span class="simpara">      Used with the getLocale methods of the various locale affected classes,      such as numfmt.     </span>    </dd>   </dt>   <dt>    <span class="term">     <b><tt>Locale::ACTUAL_LOCALE</tt></b>     (<a href="language.types.string.html" class="type string">string</a>)    </span>    <dd>     <span class="simpara">This is locale the data actually comes from.</span>    </dd>   </dt>   <dt>    <span class="term">     <b><tt>Locale::VALID_LOCALE</tt></b>     (<a href="language.types.string.html" class="type string">string</a>)    </span>    <dd>     <span class="simpara">This is the most specific locale supported by ICU.</span>    </dd>   </dt>  </dl> </p> <div id="intl.locale-constants.subtags" class="section">  <p class="para">   These constants define how the Locales are parsed or composed. They should   be used as keys in the argument array to <b>locale_compose()</b>   and are returned from <b>locale_parse()</b>   as keys of the returned associative <a href="language.types.array.html" class="type array">array</a>.   <dl>    <dt>     <span class="term">      <b><tt>Locale::LANG_TAG</tt></b>      (<a href="language.types.string.html" class="type string">string</a>)     </span>     <dd>      <span class="simpara">Language subtag</span>     </dd>    </dt>    <dt>     <span class="term">      <b><tt>Locale::EXTLANG_TAG</tt></b>      (<a href="language.types.string.html" class="type string">string</a>)     </span>     <dd>      <span class="simpara">Extended language subtag</span>     </dd>    </dt>    <dt>     <span class="term">      <b><tt>Locale::SCRIPT_TAG</tt></b>      (<a href="language.types.string.html" class="type string">string</a>)     </span>     <dd>      <span class="simpara">Script subtag</span>     </dd>    </dt>    <dt>     <span class="term">      <b><tt>Locale::REGION_TAG</tt></b>      (<a href="language.types.string.html" class="type string">string</a>)     </span>     <dd>      <span class="simpara">Region subtag</span>     </dd>    </dt>    <dt>     <span class="term">      <b><tt>Locale::VARIANT_TAG</tt></b>      (<a href="language.types.string.html" class="type string">string</a>)     </span>     <dd>      <span class="simpara">Variant subtag</span>     </dd>    </dt>    <dt>     <span class="term">      <b><tt>Locale::GRANDFATHERED_LANG_TAG</tt></b>      (<a href="language.types.string.html" class="type string">string</a>)     </span>     <dd>      <span class="simpara">Grandfathered Language subtag</span>     </dd>    </dt>    <dt>     <span class="term">      <b><tt>Locale::PRIVATE_TAG</tt></b>      (<a href="language.types.string.html" class="type string">string</a>)     </span>     <dd>      <span class="simpara">Private subtag</span>     </dd>    </dt>   </dl>  </p> </div></div>  <div id="locale.seealso" class="section">   <h2 class="title">See Also</h2>   <p class="para">    <ul class="simplelist">     <li class="member">      <a href="http://www.faqs.org/rfcs/rfc4646" class="link external">&raquo;        RFC 4646 - Tags for Identifying Languages      </a>     </li>     <li class="member">      <a href="http://www.faqs.org/rfcs/rfc4647" class="link external">&raquo;        RFC 4647 - Matching of Language Tags      </a>     </li>     <li class="member">      <a href="http://www.unicode.org/cldr/" class="link external">&raquo;        Unicode CLDR Project:Common Locale Data Repository      </a>     </li>     <li class="member">      <a href="http://www.iana.org/assignments/language-subtag-registry" class="link external">&raquo;        IANA Language Subtags Registry      </a>     </li>     <li class="member">      <a href="http://www.icu-project.org/userguide/locale.html" class="link external">&raquo; ICU User Guide - Locale</a>     </li>     <li class="member">      <a href="http://www.icu-project.org/apiref/icu4c/uloc_8h.html#_details" class="link external">&raquo; ICU Locale api</a>     </li>    </ul>   </p>  </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="locale.acceptfromhttp.html">Locale::acceptFromHttp</a> 鈥

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -