note 93407 deleted from function.gettext by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 Sep 2009 15:07:44 +0000 |
| Subject: | note 93407 deleted from function.gettext by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160415@lists.php.net to get a copy of this message | ||
Note Submitter: mario dot ugedo at gmail dot com
----
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