After many hours of tests/debug I found this behaviour in Red Hat 7.3 (I don't test with other versions/distros)
The i18n settings doesn't work if not exits the right country code under
/usr/lib/locale/. On my original instalation I just haved /usr/lib/locale/en* files, so after reinstall the glibc-common package the example showed here it works !.
* To force reinstall of the package
rpm -i --force glibc-common-2.2.5-34.i386.rpm
* The working example $HOME/i18n.php
----begin----
#!/usr/bin/php
<?php
echo "Current i18n:".setlocale(LC_ALL, 0)."\n\n";
$language = 'es_ES';
$newLocale=setlocale (LC_ALL, $language);
echo "After i18n:$newLocale\n\n";
$domain = 'messages';
bindtextdomain($domain, "./locale");
textdomain($domain);
echo gettext("The string must be here\n");
?>
----end----
* My $HOME/locale/es_ES/LC_MESSAGES/messages.po
----begin----
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2003-03-18 10:52+0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
#: i18n.php:16
msgid "The string must be here\n"
msgstr "La cadena debe ir aquí\n"
----end----
I hope this helps to you
Thanks
Hardy Beltran Monasterios