<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.gettext.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.gettext.php',
    1 => 'gettext',
    2 => 'Recherche un message dans le domaine courant',
  ),
  'up' => 
  array (
    0 => 'ref.gettext.php',
    1 => 'Fonctions Gettext',
  ),
  'prev' => 
  array (
    0 => 'function.dngettext.php',
    1 => 'dngettext',
  ),
  'next' => 
  array (
    0 => 'function.ngettext.php',
    1 => 'ngettext',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/gettext/functions/gettext.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.gettext" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">gettext</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">gettext</span> &mdash; <span class="dc-title">Recherche un message dans le domaine courant</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.gettext-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>gettext</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$message</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Recherche un message dans le domaine courant.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.gettext-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">message</code></dt>
     <dd>
      <p class="para">
       Le message à traduire.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.gettext-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne une chaîne traduite, si elle en a trouvé une dans la table
   de traduction, ou bien le message <code class="parameter">message</code>,
   s&#039;il n&#039;a pas été trouvé.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.gettext-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple avec <span class="function"><strong>gettext()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Choix de l'allemand<br /></span><span style="color: #0000BB">putenv</span><span style="color: #007700">(</span><span style="color: #DD0000">'LC_ALL=de_DE'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">setlocale</span><span style="color: #007700">(</span><span style="color: #0000BB">LC_ALL</span><span style="color: #007700">, </span><span style="color: #DD0000">'de_DE'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Spécifie la localisation des tables de traduction<br /></span><span style="color: #0000BB">bindtextdomain</span><span style="color: #007700">(</span><span style="color: #DD0000">"myPHPApp"</span><span style="color: #007700">, </span><span style="color: #DD0000">"./locale"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Choisit le domaine<br /></span><span style="color: #0000BB">textdomain</span><span style="color: #007700">(</span><span style="color: #DD0000">"myPHPApp"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// La traduction est cherchée dans ./locale/de_DE/LC_MESSAGES/myPHPApp.mo<br /><br />// Affichage d'un message de test<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">gettext</span><span style="color: #007700">(</span><span style="color: #DD0000">"Bienvenue dans mon application PHP"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Ou utiliser l'alias _() pour remplacer gettext()<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">_</span><span style="color: #007700">(</span><span style="color: #DD0000">"Passez une bonne journée"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>
 

 <div class="refsect1 notes" id="refsect1-function.gettext-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Il est possible d&#039;utiliser le caractère souligné (_) comme alias de cette fonction.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Le fait de définir une langue n&#039;est pas suffisant pour certains
    systèmes d&#039;exploitation et l&#039;utilisation de la fonction
    <span class="function"><a href="function.putenv.php" class="function">putenv()</a></span> est nécessaire afin de définir la
    locale courante.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.gettext-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.-.php" class="function" rel="rdfs-seeAlso">_()</a> - Alias de gettext</span></li>
    <li><span class="function"><a href="function.setlocale.php" class="function" rel="rdfs-seeAlso">setlocale()</a> - Modifie les informations de localisation</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>