note 77570 added to ref.gettext
| From: | bodypheo | Date: | Tue, 04 Sep 2007 15:11:43 +0000 |
| Subject: | note 77570 added to ref.gettext | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130168@lists.php.net to get a copy of this message | ||
Hello all,
I am having some troubles with gettext, I hope some of you can help me.
Well I have the next code:
<?php
$language = "es_ES";
if (isSet($_GET["locale"])) $language = $_GET["locale"];
putenv("LANG=$language");
$locale = setlocale(LC_ALL, $language);
echo $language;
$gettext_domain = 'messages';
bindtextdomain($gettext_domain, "./locale");
textdomain($gettext_domain);
echo _("cadena");
echo "<br />";
phpinfo();
?>
and under directory I have:
locale/
/en
/LC_MESSAGES
messages.mo
messages.po
/es_ES
/LC_MESSAGES
messages.mo
messages.po
/fr_FR
/LC_MESSAGES
messages.mo
messages.po
messages.mo and po are exactly the same file and they have been compiled with msgfmt under the linux
server.
When I open page by default it send es_ES and string is changed properly, but it does not work when
I put en or fr_FR in the file.
Anyone can see the problem?
server was restarted after many test and error with no solution.
----
Server IP: 130.206.1.5
Probable Submitter: 80.36.138.63
----
Manual Page -- http://www.php.net/manual/en/ref.gettext.php
Edit -- https://master.php.net/note/edit/77570
Del: integrated -- https://master.php.net/note/delete/77570/integrated
Del: useless -- https://master.php.net/note/delete/77570/useless
Del: bad code -- https://master.php.net/note/delete/77570/bad+code
Del: spam -- https://master.php.net/note/delete/77570/spam
Del: non-english -- https://master.php.net/note/delete/77570/non-english
Del: in docs -- https://master.php.net/note/delete/77570/in+docs
Del: other reasons-- https://master.php.net/note/delete/77570
Reject -- https://master.php.net/note/reject/77570
Search -- https://master.php.net/manage/user-notes.php