note 105413 added to book.gettext
| From: | laurent dot defoer at gmail dot com | Date: | Tue, 16 Aug 2011 11:16:17 +0000 |
| Subject: | note 105413 added to book.gettext | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182506@lists.php.net to get a copy of this message | ||
Function for resolved a Apache GetText Caching on developpement without restart Apache if you modify
your po/mo files.
public function translation() {
if (GETTEXT_CACHING == 0) {
$targetFolder = "locale/".$this->getlanguage."/LC_MESSAGES/";
$folder = opendir($targetFolder);
while (false !== ($file = readdir($folder))) {
$pathFiles = $targetFolder."/".$file;
if ($file != ".." AND $file != "." AND !is_dir($fichier) AND
strrchr($file,'.') == '.mo' AND $file != 'default.mo') {
unlink($pathFiles);
}
}
closedir($folder);
$translatefile = 'default'.time();
copy('locale/'.$this->getlanguage.'/LC_MESSAGES/default.mo',
'locale/'.$this->getlanguage.'/LC_MESSAGES/'.$translatefile.'.mo');
} else $translatefile = 'default';
setlocale(LC_ALL, $this->getlanguage);
putenv("LC_ALL=".$this->getlanguage);
bindtextdomain($translatefile, 'locale');
textdomain($translatefile);
bind_textdomain_codeset($translatefile, 'UTF-8');
}
----
Server IP: 69.147.83.197
Probable Submitter: 82.236.240.210
----
Manual Page -- http://www.php.net/manual/en/book.gettext.php
Edit -- https://master.php.net/note/edit/105413
Del: integrated -- https://master.php.net/note/delete/105413/integrated
Del: useless -- https://master.php.net/note/delete/105413/useless
Del: bad code -- https://master.php.net/note/delete/105413/bad+code
Del: spam -- https://master.php.net/note/delete/105413/spam
Del: non-english -- https://master.php.net/note/delete/105413/non-english
Del: in docs -- https://master.php.net/note/delete/105413/in+docs
Del: other reasons-- https://master.php.net/note/delete/105413
Reject -- https://master.php.net/note/reject/105413
Search -- https://master.php.net/manage/user-notes.php