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

📄 class.messageformatter.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 MessageFormatter 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="normalizer.normalize.html">Normalizer::normalize</a></div> <div class="next" style="text-align: right; float: right;"><a href="messageformatter.create.html">MessageFormatter::create</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 MessageFormatter class</h1>  <div class="partintro">    <div id="messageformatter.intro" class="section">   <h2 class="title">Introduction</h2>   <p class="simpara">    MessageFormatter is a concrete class that enables users to produce    concatenated, language-neutral messages. The methods supplied in this    class are used to build all the messages that are seen by end users.   </p>   <p class="simpara">    The MessageFormatter class assembles messages from various fragments (such    as text fragments, numbers, and dates) supplied by the program. Because of    the MessageFormatter class, the program does not need to know the order of    the fragments. The class uses the formatting specifications for the    fragments to assemble them into a message that is contained in a single    string within a resource bundle. For example, MessageFormatter enables you    to print the phrase &quot;Finished printing x out of y files...&quot; in a manner    that still allows for flexibility in translation.   </p>   <p class="simpara">    Previously, an end user message was created as a sentence and handled as a    string. This procedure created problems for localizers because the    sentence structure, word order, number format and so on are very different    from language to language. The language-neutral way to create messages    keeps each part of the message separate and provides keys to the data.    Using these keys, the MessageFormatter class can concatenate the parts of    the message, localize them, and display a well-formed string to the end    user.   </p>   <p class="simpara">    MessageFormatter takes a set of objects, formats them, and then inserts    the formatted strings into the pattern at the appropriate places. Choice    formats can be used in conjunction with MessageFormatter to handle    plurals, match numbers, and select from an array of items. Typically, the    message format will come from resources and the arguments will be    dynamically set at runtime.   </p>  </div>    <div id="messageformatter.synopsis" class="section">   <h2 class="title">Class synopsis</h2>      <div class="classsynopsis">    <div class="ooclass">     <b class="classname">MessageFormatter</b>    </div>        <div class="classsynopsisinfo">     <span class="ooclass">      <b class="classname">MessageFormatter</b>     </span>     {</div>        <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div>    <div class="constructorsynopsis dc-description">    <span class="methodname"><b><a href="messageformatter.create.html" class="function">MessageFormatter::__construct</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">$pattern</tt></span>   )</div>    <div class="methodsynopsis dc-description">   <span class="type">MessageFormatter</span>    <span class="methodname"><b><a href="messageformatter.create.html" class="function">MessageFormatter::create</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">$pattern</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">string</span>    <span class="methodname"><b><a href="messageformatter.formatmessage.html" class="function">MessageFormatter::formatMessage</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">$pattern</tt></span>   , <span class="methodparam"><span class="type">array</span> <tt class="parameter">$args</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="type">string</span>    <span class="methodname"><b><a href="messageformatter.format.html" class="function">MessageFormatter::format</a></b></span>    ( <span class="methodparam"><span class="type">array</span> <tt class="parameter">$args</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="type">integer</span>    <span class="methodname"><b><a href="messageformatter.geterrorcode.html" class="function">MessageFormatter::getErrorCode</a></b></span>    ( <span class="methodparam">void</span>   )</div><div class="methodsynopsis dc-description">   <span class="type">string</span>    <span class="methodname"><b><a href="messageformatter.geterrormessage.html" class="function">MessageFormatter::getErrorMessage</a></b></span>    ( <span class="methodparam">void</span>   )</div><div class="methodsynopsis dc-description">   <span class="type">string</span>    <span class="methodname"><b><a href="messageformatter.getlocale.html" class="function">MessageFormatter::getLocale</a></b></span>    ( <span class="methodparam">void</span>   )</div><div class="methodsynopsis dc-description">   <span class="type">string</span>    <span class="methodname"><b><a href="messageformatter.getpattern.html" class="function">MessageFormatter::getPattern</a></b></span>    ( <span class="methodparam">void</span>   )</div><div class="methodsynopsis dc-description">   <span class="modifier">static</span>   <span class="type">array</span>    <span class="methodname"><b><a href="messageformatter.parsemessage.html" class="function">MessageFormatter::parseMessage</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">$value</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="type">array</span>    <span class="methodname"><b><a href="messageformatter.parse.html" class="function">MessageFormatter::parse</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$value</tt></span>   )</div><div class="methodsynopsis dc-description">   <span class="type">boolean</span>    <span class="methodname"><b><a href="messageformatter.setpattern.html" class="function">MessageFormatter::setPattern</a></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$pattern</tt></span>   )</div>   }</div>     </div>  <div id="messageformatter.seealso" class="section">   <h2 class="title">See Also</h2>   <p class="para">    <ul class="simplelist">     <li class="member">      <a href="http://icu-project.org/userguide/formatParse.html" class="link external">&raquo;        ICU formatting documentation      </a>     </li>     <li class="member">      <a href="http://icu-project.org/userguide/formatMessages.html" class="link external">&raquo;        ICU message formatting description      </a>     </li>     <li class="member">      <a href="http://icu-project.org/apiref/icu4c/classMessageFormat.html#_details" class="link external">&raquo; ICU message formatters</a>     </li>     <li class="member">      <a href="http://icu-project.org/apiref/icu4c/classChoiceFormat.html#_details" class="link external">&raquo; ICU choice formatters</a>     </li>    </ul>   </p>  </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="messageformatter.create.html">MessageFormatter::create</a> 鈥

⌨️ 快捷键说明

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