<?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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'class.resourcebundle.php',
    1 => 'ResourceBundle',
    2 => 'La classe 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' => 'fr',
    '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">La classe 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">Introduction</h2>
   <p class="simpara">
    Les applications localisées ont souvent besoin de manipuler des données devant être
    personnalisées en fonction d&#039;une locale considérée, p. ex. : messages, libellés, chaînes
    de formatage. ICU permet de définir des ressources que l&#039;application pourra charger
    avec une locale une fois pour toutes : tous les accès ultérieurs se feront au moyen
    d&#039;une interface unique non dépendante de la locale considérée.
   </p>
   <p class="simpara">
    Cette classe permet l&#039;accès aux fichiers de données de ICU. Ces fichiers représentent
    des tableaux binaires que ICU utilise pour stocker les données localisées. 
   </p>
   <p class="simpara">
    Les bundles de ressources ICU supportent les ressources simples et complexes. Les ressources
    complexes sont des conteneurs qui peuvent être indexés numériquement ou littéralement (comme
    les tableaux PHP). Les ressources simples, elles, peuvent être de type chaîne, entier, binaire
    ou tableau numérique.
   </p>
   <p class="simpara">
    <span class="classname"><strong class="classname">ResourceBundle</strong></span> supporte l&#039;accès direct aux données via la syntaxe
    des tableaux ainsi que l&#039;itération grâce à <a href="control-structures.foreach.php" class="link">foreach</a>.
    Ces possibilités existent aussi via les méthodes. Le résultat sera une valeur PHP pour les ressources
    simples, ou un objet <span class="classname"><strong class="classname">ResourceBundle</strong></span> pour les ressources complexes.
    Les ressources sont en lecture seule.
   </p>
  </div>
  

  <div class="section" id="resourcebundle.synopsis">
   <h2 class="title">Synopsis de la classe</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">/* Méthodes */</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"><span class="type"><a href="class.resourcebundle.php" class="type ResourceBundle">ResourceBundle</a></span>|<span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<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 class="type"><a href="language.types.null.php" class="type null">null</a></span></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">Historique</h2>
    <table class="doctable informaltable">
     
      <thead>
       <tr>
        <th>Version</th>
        <th>Description</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td>8.0.0</td>
        <td>
         La classe <span class="classname"><strong class="classname">ResourceBundle</strong></span> implémente désormais <span class="interfacename"><a href="class.iteratoraggregate.php" class="interfacename">IteratorAggregate</a></span>.
         Auparavant, seule <span class="interfacename"><a href="class.traversable.php" class="interfacename">Traversable</a></span> était implémentée.
        </td>
       </tr>

       <tr>
        <td>7.4.0</td>
        <td>
         La classe <span class="classname"><strong class="classname">ResourceBundle</strong></span> implémente désormais <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">Voir aussi</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;
       Configuration des ressources ICU
      </a>
     </li>
     <li>
      <a href="https://unicode-org.github.io/icu/userguide/icu_data/" class="link external">&raquo;&nbsp;ICU Data</a>
     </li>
    </ul>
   </p>
  </div>
 </div>

 







































<h2>Sommaire</h2><ul class="chunklist chunklist_reference"><li><a href="resourcebundle.count.php">ResourceBundle::count</a> — R&eacute;cup&egrave;re le nombre d'&eacute;l&eacute;ments dans le faisceau</li><li><a href="resourcebundle.create.php">ResourceBundle::create</a> — Cr&eacute;e une ressource repr&eacute;sentant un faisceau</li><li><a href="resourcebundle.get.php">ResourceBundle::get</a> — R&eacute;cup&egrave;re les donn&eacute;es depuis le faisceau</li><li><a href="resourcebundle.geterrorcode.php">ResourceBundle::getErrorCode</a> — R&eacute;cup&egrave;re le dernier code erreur du faisceau</li><li><a href="resourcebundle.geterrormessage.php">ResourceBundle::getErrorMessage</a> — R&eacute;cup&egrave;re le dernier message d'erreur depuis le faisceau</li><li><a href="resourcebundle.locales.php">ResourceBundle::getLocales</a> — R&eacute;cup&egrave;re les locales support&eacute;es</li></ul>
</div>
<?php manual_footer($setup); ?>