note 93407 added to function.gettext
| From: | mario dot ugedo at gmail dot com | Date: | Tue, 08 Sep 2009 17:12:39 +0000 |
| Subject: | note 93407 added to function.gettext | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-160308@lists.php.net to get a copy of this message | ||
It's very important call a bind_textdomain_codeset(..) function.
<?php
// Set language to Spanish
//setlocale(LC_ALL, 'es_ES'); // es_ES not in the server
setlocale(LC_MESSAGES, 'es_ES.utf8');
// run ok with LC_MESSAGES
// Specify location of translation tables
bindtextdomain("myAppPhp", "includes/locale");
bind_textdomain_codeset("myAppPhp", 'UTF-8');
// It's very important
// Choose domain
textdomain("webToldosMonita");
// Translation is looking for in includes/locale/.utf8/LC_MESSAGESmyAppPhp.mo now
?>
<p><?=_("Welcome to My PHP Application");?></p>
<p><?=gettext("Have a nice day");?></p>
Ah, it's very important use locale should be install in the server
shell command "locale -a"
The hosting server could be all locala installed
good luck
----
Server IP: 80.64.47.13
Probable Submitter: 87.222.191.34
----
Manual Page -- http://www.php.net/manual/en/function.gettext.php
Edit -- https://master.php.net/note/edit/93407
Del: integrated -- https://master.php.net/note/delete/93407/integrated
Del: useless -- https://master.php.net/note/delete/93407/useless
Del: bad code -- https://master.php.net/note/delete/93407/bad+code
Del: spam -- https://master.php.net/note/delete/93407/spam
Del: non-english -- https://master.php.net/note/delete/93407/non-english
Del: in docs -- https://master.php.net/note/delete/93407/in+docs
Del: other reasons-- https://master.php.net/note/delete/93407
Reject -- https://master.php.net/note/reject/93407
Search -- https://master.php.net/manage/user-notes.php