I've seen a lot of other threads with a similar issue but haven't found any solution that works for my scenario from them.
I have a Centos server that I am trying to get Gettext running on. My problem is that no matter what, the gettext method always returns the English translation which also doubles as the key in the .po file.
$config['language_dir'] = '/var/www/.../.../application/languages';
if ($this->config->item('language_dir') != '' && function_exists("gettext")) {
$domain = "messages";
$lang = "es_ES";
putenv("LC_ALL={$lang}");
setlocale(LC_ALL, $lang);
bindtextdomain($domain, $this->config->item('language_dir'));
textdomain($domain);
bind_textdomain_codeset($domain, 'UTF-8');
echo gettext('translate');
echo _('translate');
}
I can echo the above environment variables after they've been set to confirm everything worked. I've also confirmed that the path to the languages directory is correct and exists.
The languages directory has the below structure:
es_ES/LC_MESSAGES/
messages.po
messages.mo
My .po file:
msgid ""
msgstr ""
"Project-Id-Version: es_ES 0.1.0\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es_ES\n"
msgid "translate"
msgstr "lalalala"
When I run "locale -a | grep es_ES" I get:
es_ES
es_ES@euro
es_ES.iso88591
es_ES.iso885915@euro
es_ES.utf8
Also, I'm running PHP 5.4, w/ Codeigniter. Any help would be greatly appreciated!