Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your code is correct. You probably just have to install the correct language package on the server you are running the script on.</p> <p>In the terminal if the language you want use is not listed when running the command <code>sudo locale -a</code>, then you'll have to install it by running the following command :</p> <pre><code>sudo /usr/share/locales/install-language-pack de_DE </code></pre> <p>(<code>sudo</code> here is optional if your user has root permissions)</p> <p>Then if you double check with <code>sudo locale -a</code> you should see <code>de_DE.utf8</code>.</p> <p>If you want to install french language package run </p> <pre><code>sudo /usr/share/locales/install-language-pack fr_FR </code></pre> <p>Then you'll be allowed to set your language to these in PHP by using <code>setlocale(...)</code> exactly like you did it.</p> <p><br/></p> <p><strong>Note:</strong> If you are in a non utf8 project you'll need to generate other formats from installed packages. Here is how to proceed on ubuntu (this work on debian as well) :</p> <p>edit <strong><em>/var/lib/locales/supported.d/cs</em></strong> and add the following lines</p> <pre><code> fr_FR.iso88591 ISO-8859-1 fr_CA.iso88591 ISI-8859-1 </code></pre> <p>and run </p> <pre><code> sudo dpkg-reconfigure locales </code></pre> <p>Then by running again <code>sudo locale -a</code> you should see both <strong>fr_FR.iso88591</strong> and <strong>fr_CA.iso88591</strong> in the list and you can use it in php by calling <code>setlocale(LC_ALL, 'fr_FR.iso88591');</code></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload