I have a .po and a .mo file in a folder whose address is /locale/nld_nld/LC_MESSAGES/. Both the files' names are messages. I've been trying to use the following code:
try.php:
<?php
require_once("Localization.php");
echo _("Hello World!");
?>
the Localization.php goes here:
<?php
$locale = "nld_nld";
if (isSet($_GET["locale"])) $locale = $_GET["locale"];
putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain("messages", "./locale");
bind_textdomain_codeset("messages", 'UTF-8');
textdomain("messages");
?>
Both the try.php and the Localization files are in the same directory. Also, I use xampp
. I also implemented the phpinfo();
. In the table, in front of 'GetText Support', enabled was mentioned. The messages.po and the messages.mo files are valid files which I created using poEdit. I'm a windows user. However, when I opened try.php, it simply echoed Hello World! (not its translated string. Also, I've translated the .po file 100% (according to poEdit
). Still, I'm not getting the results. A little help on this would be appreciated.
Thanks in advance!