I've been trying to use this gettext functionality to add localization functionality to my website. Please keep in mind I'm not a webdev and this field is rather unknow to me. After following several tutorials I have installed the extension and have enabled it in the php.ini. I'm also using PoEdit for creating the .po files. My php code looks like this :
<?php
$language = "en_US";
putenv("LC_ALL={$locale}");
$domain = 'messages';
bindtextdomain($domain, './locale');
bind_textdomain_codeset($domain, 'UTF-8');
textdomain($domain);
?>
Then I call it like this :
<p class="welcome"><?=_('welcome');?></p>
As my understanding goes "_" is an alieas for the gettext method. Both dont seem to work. The messages .po file looks like this :
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2017-04-23 11:27+0300\n"
"PO-Revision-Date: 2017-04-23 11:36+0300\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.1\n"
"X-Poedit-Basepath: ../../..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Last-Translator: \n"
"Language: en\n"
"X-Poedit-SearchPath-0: index.php\n"
#: index.php:63
msgid "welcome"
msgstr "Welcome"
#: index.php:64
msgid "to-leadersplay"
msgstr "to Leadersplay"
My directory structure looks like this :
NO matter what I do the strings that are being displayed seem to be the keys and not the translations from the file. In my current example I get welcome but I expect to get Welcome (with a capital W)