Note that there are some explanatory texts on larger screens.

plurals
  1. POGettext doesn't translate
    primarykey
    data
    text
    <p>For the past few days i've been struggling with php, gettext and getting my, soon to be, new website translated from danish to english.</p> <p>I have my directories with my .po and .mo files set up as following:</p> <pre><code>/locale/en_US/LC_MESSAGES/ </code></pre> <p>As per this tutorial: <a href="http://mel.melaxis.com/devblog/2005/08/06/localizing-php-web-sites-using-gettext/" rel="nofollow">Localizing PHP web sites using gettext</a> i added this:</p> <pre><code>$locale = "en_US"; if (isSet($_GET["locale"])) $locale = $_GET["locale"]; putenv("LC_ALL=$locale"); setlocale(LC_ALL, $locale); bindtextdomain("messages", "./locale"); textdomain("messages"); </code></pre> <p>I added a five entires in on my page:</p> <pre><code>echo _('Overskrift 1') </code></pre> <p>But when i view the page on my server, a Debian box with PHP 5.4 and gettext support enabled, nothing is translated.</p> <p>I have no idea what i'm doing wrong. I'm sure it's something small, but i just can't see it. Maybe you guys have some pointers?</p> <p>My .po file:</p> <pre><code>msgid "" msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: POEditor.com\n" "Project-Id-Version: Portfolio\n" "Language: en\n" #: msgid "Overskrift 1" msgstr "Headline 1" #: msgid "Overskrift 2" msgstr "Headline 2" #: msgid "Overskrift 3" msgstr "Headline 3" #: msgid "Overskrift 4" msgstr "Headline 4" #: msgid "Overskrift 5" msgstr "Headline 5" </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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