note 105413 modified in book.gettext by googleguy

From: Date: Mon, 19 Aug 2013 17:58:35 +0000
Subject: note 105413 modified in book.gettext by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196020@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. <?php 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'); } ?> --was-- Function for resolved a Apache GetText Caching on developpement without restart Apache if you modify your po/mo files. <?php 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'); } ?> http://php.net/manual/en/book.gettext.php

« previous php.notes (#196020) next »