<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>The ResourceBundle class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="intldateformatter.settimezone.html">IntlDateFormatter::setTimeZone</a></div> <div class="next" style="text-align: right; float: right;"><a href="resourcebundle.count.html">ResourceBundle::count</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 id="class.resourcebundle" class="reference"> <h1 class="title">The ResourceBundle class</h1> <div class="partintro"><p class="verinfo">(PHP >= 5.3.2, PECL intl >= 2.0.0)</p> <div class="section" id="resourcebundle.intro"> <h2 class="title">Introduction</h2> <p class="simpara"> Localized software products often require sets of data that are to be customized depending on current locale, e.g.: messages, labels, formatting patterns. ICU resource mechanism allows to define sets of resources that the application can load on locale basis, while accessing them in unified locale-independent fashion. </p> <p class="simpara"> This class implements access to ICU resource data files. These files are binary data arrays which ICU uses to store the localized data. </p> <p class="simpara"> ICU resource bundle can hold simple resources and complex resources. Complex resources are containers which can be either integer-indexed or string-indexed (just like PHP arrays). Simple resources can be of the following typos: string, integer, binary data field or integer array. </p> <p class="simpara"> <strong class="classname">ResourceBundle</strong> supports direct access to the data through array access pattern and iteration via <a href="control-structures.foreach.html" class="link">foreach</a>, as well as access via class methods. The result will be PHP value for simple resources and <strong class="classname">ResourceBundle</strong> object for complex ones. All resources are read-only. </p> </div> <div class="section" id="resourcebundle.synopsis"> <h2 class="title">Class synopsis</h2> <div class="classsynopsis"> <div class="ooclass"> </div> <div class="classsynopsisinfo"> <span class="ooclass"> <strong class="classname">ResourceBundle</strong> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> <div class="constructorsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><a href="resourcebundle.create.html" class="methodname">__construct</a></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$locale</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$bundlename</code></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$fallback</code></span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="resourcebundle.count.html" class="methodname">count</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="modifier">static</span> <span class="type">ResourceBundle</span> <span class="methodname"><a href="resourcebundle.create.html" class="methodname">create</a></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$locale</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$bundlename</code></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$fallback</code></span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="resourcebundle.geterrorcode.html" class="methodname">getErrorCode</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="resourcebundle.geterrormessage.html" class="methodname">getErrorMessage</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="resourcebundle.get.html" class="methodname">get</a></span> ( <span class="methodparam"><span class="type"><span class="type string|int">string|int</span></span> <code class="parameter">$index</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="resourcebundle.locales.html" class="methodname">getLocales</a></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$bundlename</code></span> )</div> }</div> </div> <div class="section" id="resourcebundle.seealso"> <h2 class="title">See Also</h2> <p class="para"> <ul class="simplelist"> <li class="member"> <a href="http://userguide.icu-project.org/locale/resources" class="link external">» ICU Resource Management </a> </li> <li class="member"> <a href="http://userguide.icu-project.org/icudata" class="link external">» ICU Data</a> </li> </ul> </p> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="resourcebundle.count.html">ResourceBundle::count</a> — Get number of elements in the bundle</li><li><a href="resourcebundle.create.html">ResourceBundle::create</a> — Create a resource bundle</li><li><a href="resourcebundle.geterrorcode.html">ResourceBundle::getErrorCode</a> — Get bundle's last error code.</li><li><a href="resourcebundle.geterrormessage.html">ResourceBundle::getErrorMessage</a> — Get bundle's last error message.</li><li><a href="resourcebundle.get.html">ResourceBundle::get</a> — Get data from the bundle</li><li><a href="resourcebundle.locales.html">ResourceBundle::getLocales</a> — Get supported locales</li></ul> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="intldateformatter.settimezone.html">IntlDateFormatter::setTimeZone</a></div> <div class="next" style="text-align: right; float: right;"><a href="resourcebundle.count.html">ResourceBundle::count</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></body></html>