The following example works on Mac OS X with Apache, i.e. I get the translated string echoed back. But on Ubuntu with lighttpd I get the original text 'Inactive account'. I've tried all sorts of combinations of environment varialbes without any luck. It's not file permissions either because I can echo out the contents of the .mo file.
<?php
//$locale = 'sv_SE.UTF-8';
$locale = 'sv_SE';
$dir = dirname(__FILE__);
// File permission is apparantly not a problem as this works...
//echo file_get_contents($dir . '/sv_SE/LC_MESSAGES/flattr.mo');
putenv("LANG=$locale");
putenv("LANGUAGE=$locale");
putenv("LC_ALL=$locale");
putenv("LC_MESSAGES=$locale");
setlocale(LC_ALL, $locale);
setlocale(LC_MESSAGES, $locale);
//setlocale(LANG, $locale);
//setlocale(LANGUAGE, $locale);
bindtextdomain('flattr', $dir);
//bind_textdomain_codeset("flattr", 'UTF-8');
textdomain('flattr');
echo _("Inactive account");
?>
Anyone have any ideas?
sv_SE.UTF-8
to/etc/locale.gen
and then runsudo locale-gen
. – Engel