I am trying to setup getText() with PHP
$locale = "en_GB";
//if (isset($_GET["locale"])) $locale = $_GET["locale"];
$domain = 'messages';
bindtextdomain($domain, "./locale");
textdomain($domain);
bind_textdomain_codeset($domain, 'UTF-8');
var_dump( file_exists("locale/".$locale."/LC_MESSAGES/".$domain.".mo" ) );
$results = gettext("Velkommen");
if ($results === "Velkommen") {
echo "Original English was returned. Something wrong\n";
}
echo $results . "\n";
?>
<?= _("Velkommen"); ?>`
var_dump returns true, but I get the errormessage saying something went wrong.
Checking locale -a I know that en_GB is present on the server.
I have tried multiple suggestions found on Google. Tried to change the path in bindtextdomain
This example works for me.