<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.intl.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'class.resourcebundle.php',
    1 => 'ResourceBundle',
    2 => 'Класс ResourceBundle',
  ),
  'up' => 
  array (
    0 => 'book.intl.php',
    1 => 'intl',
  ),
  'prev' => 
  array (
    0 => 'intldateformatter.settimezone.php',
    1 => 'IntlDateFormatter::setTimeZone',
  ),
  'next' => 
  array (
    0 => 'resourcebundle.count.php',
    1 => 'ResourceBundle::count',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/intl/resourcebundle.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/class.resourcebundle.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="class.resourcebundle" class="reference">
 <h1 class="title">Класс ResourceBundle</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.3.2, PHP 7, PHP 8, PECL intl &gt;= 2.0.0)</p>

  
  <div class="section" id="resourcebundle.intro">
   <h2 class="title">Введение</h2>
   <p class="simpara">
    Локализованные программные продукты часто нуждаются в наборах данных
    подготовленных в зависимости от текущей локали, например: сообщения, метки,
    шаблоны форматирования. Механизм ресурсов ICU позволяет задать наборы
    ресурсов, которые приложение может загрузить в зависимости от текущей локали
    и использовать унифицированным, не зависящим от локали, образом.
   </p>
   <p class="simpara">
    Этот класс реализует доступ к файлам ресурсов ICU. Эти файлы являются бинарными
    массивами данных, которые ICU использует для хранения локализованных данных.
   </p>
   <p class="simpara">
    Пакет ресурсов ICU может содержать простые и сложные ресурсы. Сложные ресурсы - это
    контейнеры, которые могут быть индексированы как числами так и строками (аналогично массивам PHP).
    Простые ресурсы могут быть следующих типов: строки, целые, бинарные поля данных и
    целочисленные массивы.
   </p>
   <p class="simpara">
    <span class="classname"><strong class="classname">ResourceBundle</strong></span>поддерживает прямой доступ к данным через синтаксис
    доступа к массивам и итерироваться через <a href="control-structures.foreach.php" class="link">foreach</a>,
    так же как и доступ через методы. В результате будет получено значение PHP для простых
    ресурсов и объекты <span class="classname"><strong class="classname">ResourceBundle</strong></span> для сложных. Все ресурсы доступны только для
    чтения.
   </p>
  </div>
  

  <div class="section" id="resourcebundle.synopsis">
   <h2 class="title">Обзор класса</h2>

   
   <div class="classsynopsis"><div class="classsynopsisinfo">
    
     <span class="modifier">class</span> <strong class="classname"><strong class="classname">ResourceBundle</strong></strong>
    

    
     <span class="modifier">implements</span>
      <a href="class.iteratoraggregate.php" class="interfacename">IteratorAggregate</a>,

     <a href="class.countable.php" class="interfacename">Countable</a> {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Методы */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="resourcebundle.create.php" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$locale</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$bundle</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$fallback</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></span></span>)</div>

    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="resourcebundle.count.php" class="methodname">count</a></span>(): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><a href="resourcebundle.create.php" class="methodname">create</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$locale</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$bundle</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$fallback</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="class.resourcebundle.php" class="type ResourceBundle">ResourceBundle</a></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="resourcebundle.get.php" class="methodname">get</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$index</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$fallback</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></span></span>): <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="resourcebundle.geterrorcode.php" class="methodname">getErrorCode</a></span>(): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="resourcebundle.geterrormessage.php" class="methodname">getErrorMessage</a></span>(): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><a href="resourcebundle.locales.php" class="methodname">getLocales</a></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$bundle</code></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

   }</div>
   

   <div class="section">
    <h2 class="title">Список изменений</h2>
    <table class="doctable informaltable">
     
      <thead>
       <tr>
        <th>Версия</th>
        <th>Описание</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td>8.0.0</td>
        <td>
         Класс <span class="classname"><strong class="classname">ResourceBundle</strong></span> теперь реализует
         интерфейс <span class="interfacename"><a href="class.iteratoraggregate.php" class="interfacename">IteratorAggregate</a></span>.
         Ранее был реализован интерфейс <span class="interfacename"><a href="class.traversable.php" class="interfacename">Traversable</a></span>.
        </td>
       </tr>

       <tr>
        <td>7.4.0</td>
        <td>
         Класс <span class="classname"><strong class="classname">ResourceBundle</strong></span> теперь реализует
         интерфейс <span class="interfacename"><a href="class.countable.php" class="interfacename">Countable</a></span>.
        </td>
       </tr>

      </tbody>
     
    </table>

   </div>
  </div>

  

  <div class="section" id="resourcebundle.seealso">
   <h2 class="title">Смотрите также</h2>
   <p class="para">
    <ul class="simplelist">
     <li>
      <a href="https://unicode-org.github.io/icu/userguide/locale/resources.html" class="link external">&raquo;&nbsp;
       Менеджер ресурсов ICU
      </a>
     </li>
     <li>
      <a href="https://unicode-org.github.io/icu/userguide/icu_data/" class="link external">&raquo;&nbsp;Данные ICU</a>
     </li>
    </ul>
   </p>
  </div>
 </div>

 




































<h2>Содержание</h2><ul class="chunklist chunklist_reference"><li><a href="resourcebundle.count.php">ResourceBundle::count</a> — Получить количество элементов в пакете</li><li><a href="resourcebundle.create.php">ResourceBundle::create</a> — Создать пакет ресурсов</li><li><a href="resourcebundle.get.php">ResourceBundle::get</a> — Получает данные из пакета</li><li><a href="resourcebundle.geterrorcode.php">ResourceBundle::getErrorCode</a> — Получить последний код ошибки пакета</li><li><a href="resourcebundle.geterrormessage.php">ResourceBundle::getErrorMessage</a> — Получить последнее сообщение об ошибке пакета</li><li><a href="resourcebundle.locales.php">ResourceBundle::getLocales</a> — Получить поддерживаемые локали</li></ul>
</div>
<?php manual_footer($setup); ?>