diff options
Diffstat (limited to 'framework/I18N')
-rw-r--r-- | framework/I18N/TChoiceFormat.php | 5 | ||||
-rw-r--r-- | framework/I18N/TDateFormat.php | 9 | ||||
-rw-r--r-- | framework/I18N/TGlobalization.php | 3 | ||||
-rw-r--r-- | framework/I18N/TGlobalizationAutoDetect.php | 4 | ||||
-rw-r--r-- | framework/I18N/TI18NControl.php | 3 | ||||
-rw-r--r-- | framework/I18N/TNumberFormat.php | 5 | ||||
-rw-r--r-- | framework/I18N/TTranslate.php | 5 | ||||
-rw-r--r-- | framework/I18N/TTranslateParameter.php | 3 | ||||
-rw-r--r-- | framework/I18N/Translation.php | 5 | ||||
-rw-r--r-- | framework/I18N/core/CultureInfo.php | 2 | ||||
-rw-r--r-- | framework/I18N/core/Gettext/TGettext.php | 66 | ||||
-rw-r--r-- | framework/I18N/core/MessageCache.php | 48 | ||||
-rw-r--r-- | framework/I18N/core/TCache_Lite.php | 1 |
13 files changed, 73 insertions, 86 deletions
diff --git a/framework/I18N/TChoiceFormat.php b/framework/I18N/TChoiceFormat.php index ad9a4500..4525aaad 100644 --- a/framework/I18N/TChoiceFormat.php +++ b/framework/I18N/TChoiceFormat.php @@ -4,9 +4,8 @@ * * @author Wei Zhuo <weizhuo[at]gmail[dot]com> * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2013 PradoSoft + * @copyright Copyright © 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ - * @version $Id: TChoiceFormat.php 3245 2013-01-07 20:23:32Z ctrlaltca $ * @package System.I18N */ @@ -65,7 +64,7 @@ Prado::using('System.I18N.TTranslate'); * # <tt>&</tt> -- conditional AND. * # <tt>&&</tt> -- condition AND with short circuit. * # <tt>|</tt> -- conditional OR. - * # <tt>||</tt> -- conditional OR with short circuit. + * # <tt>||</tt> -- conditional OR with short circuit. * # <tt>!</tt> -- negation. * * Additional round brackets can also be used to perform grouping. diff --git a/framework/I18N/TDateFormat.php b/framework/I18N/TDateFormat.php index 544e4973..e7846be7 100644 --- a/framework/I18N/TDateFormat.php +++ b/framework/I18N/TDateFormat.php @@ -4,9 +4,8 @@ * * @author Wei Zhuo <weizhuo[at]gmail[dot]com> * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2013 PradoSoft + * @copyright Copyright © 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ - * @version $Id: TDateFormat.php 3245 2013-01-07 20:23:32Z ctrlaltca $ * @package System.I18N */ @@ -165,7 +164,7 @@ class TDateFormat extends TI18NControl implements IDataRenderer { $this->setViewState('Value',$value,''); } - + /** * Get the default text value for this control. * @return string default text value @@ -174,7 +173,7 @@ class TDateFormat extends TI18NControl implements IDataRenderer { return $this->getViewState('DefaultText',''); } - + /** * Set the default text value for this control. * @param string default text value @@ -222,7 +221,7 @@ class TDateFormat extends TI18NControl implements IDataRenderer $defaultText = $this->getDefaultText(); if(empty($value) && !empty($defaultText)) return $this->getDefaultText(); - + $app = $this->getApplication()->getGlobalization(); //initialized the default class wide formatter diff --git a/framework/I18N/TGlobalization.php b/framework/I18N/TGlobalization.php index 6638af22..3fbaa2b4 100644 --- a/framework/I18N/TGlobalization.php +++ b/framework/I18N/TGlobalization.php @@ -4,9 +4,8 @@ * * @author Wei Zhuo<weizhuo[at]gmail[dot]com> * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2013 PradoSoft + * @copyright Copyright © 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ - * @version $Id: TGlobalization.php 3245 2013-01-07 20:23:32Z ctrlaltca $ * @package System.I18N */ diff --git a/framework/I18N/TGlobalizationAutoDetect.php b/framework/I18N/TGlobalizationAutoDetect.php index ad786401..a79a128d 100644 --- a/framework/I18N/TGlobalizationAutoDetect.php +++ b/framework/I18N/TGlobalizationAutoDetect.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo<weizhuo[at]gmail[dot]com> * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2013 PradoSoft + * @copyright Copyright © 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Revision: 1.66 $ $Date: ${DATE} ${TIME} $ * @package System.I18N @@ -32,7 +32,7 @@ class TGlobalizationAutoDetect extends TGlobalization parent::init($xml); //set the culture according to browser language settings - $http = new HTTPNegotiator(); + $http = new HTTPNegotiator(); $languages = $http->getLanguages(); if(count($languages) > 0) { diff --git a/framework/I18N/TI18NControl.php b/framework/I18N/TI18NControl.php index 97a7268a..96fc8b62 100644 --- a/framework/I18N/TI18NControl.php +++ b/framework/I18N/TI18NControl.php @@ -4,9 +4,8 @@ * * @author Wei Zhuo <weizhuo[at]gmail[dot]com> * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2013 PradoSoft + * @copyright Copyright © 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ - * @version $Id: TI18NControl.php 3245 2013-01-07 20:23:32Z ctrlaltca $ * @package System.I18N */ diff --git a/framework/I18N/TNumberFormat.php b/framework/I18N/TNumberFormat.php index 27c124f7..89eab245 100644 --- a/framework/I18N/TNumberFormat.php +++ b/framework/I18N/TNumberFormat.php @@ -4,9 +4,8 @@ * * @author Wei Zhuo <weizhuo[at]gmail[dot]com> * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2013 PradoSoft + * @copyright Copyright © 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ - * @version $Id: TNumberFormat.php 3245 2013-01-07 20:23:32Z ctrlaltca $ * @package System.I18N */ @@ -116,7 +115,7 @@ class TNumberFormat extends TI18NControl implements IDataRenderer { return $this->getViewState('DefaultText',''); } - + /** * Set the default text value for this control. * @param string default text value diff --git a/framework/I18N/TTranslate.php b/framework/I18N/TTranslate.php index 3382f925..1365b937 100644 --- a/framework/I18N/TTranslate.php +++ b/framework/I18N/TTranslate.php @@ -4,9 +4,8 @@ * * @author Wei Zhuo <weizhuo[at]gmail[dot]com> * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2013 PradoSoft + * @copyright Copyright © 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ - * @version $Id: TTranslate.php 3245 2013-01-07 20:23:32Z ctrlaltca $ * @package System.I18N */ @@ -243,7 +242,7 @@ class TTranslate extends TI18NControl $catalogue = $config['catalogue']; if (empty($catalogue)) $catalogue='messages'; Translation::init($catalogue); - + $key = $this->getKey(); if(!empty($key)) $text = $key; diff --git a/framework/I18N/TTranslateParameter.php b/framework/I18N/TTranslateParameter.php index b461a36a..d5c41230 100644 --- a/framework/I18N/TTranslateParameter.php +++ b/framework/I18N/TTranslateParameter.php @@ -4,9 +4,8 @@ * * @author Wei Zhuo <weizhuo[at]gmail[dot]com> * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2013 PradoSoft + * @copyright Copyright © 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ - * @version $Id: TTranslateParameter.php 3245 2013-01-07 20:23:32Z ctrlaltca $ * @package System.I18N */ diff --git a/framework/I18N/Translation.php b/framework/I18N/Translation.php index 5219e132..9592ef53 100644 --- a/framework/I18N/Translation.php +++ b/framework/I18N/Translation.php @@ -4,9 +4,8 @@ * * @author Wei Zhuo <weizhuo[at]gmail[dot]com> * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2013 PradoSoft + * @copyright Copyright © 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ - * @version $Id: Translation.php 3245 2013-01-07 20:23:32Z ctrlaltca $ * @package System.I18N */ @@ -40,7 +39,7 @@ class Translation extends TComponent public static function init($catalogue='messages') { static $saveEventHandlerAttached=false; - + //initialized the default class wide formatter if(!isset(self::$formatters[$catalogue])) { diff --git a/framework/I18N/core/CultureInfo.php b/framework/I18N/core/CultureInfo.php index c22ed5c4..fc20b833 100644 --- a/framework/I18N/core/CultureInfo.php +++ b/framework/I18N/core/CultureInfo.php @@ -13,7 +13,6 @@ * {@link http://prado.sourceforge.net/} * * @author Wei Zhuo <weizhuo[at]gmail[dot]com> - * @version $Id: CultureInfo.php 3187 2012-07-12 11:21:01Z ctrlaltca $ * @package System.I18N.core */ @@ -44,7 +43,6 @@ * For example, Australian English is "en_AU". * * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> - * @version $Id: CultureInfo.php 3187 2012-07-12 11:21:01Z ctrlaltca $ * @package System.I18N.core */ class CultureInfo diff --git a/framework/I18N/core/Gettext/TGettext.php b/framework/I18N/core/Gettext/TGettext.php index abf32392..2c5f91c7 100644 --- a/framework/I18N/core/Gettext/TGettext.php +++ b/framework/I18N/core/Gettext/TGettext.php @@ -32,7 +32,7 @@ /** * File::Gettext - * + * * @author Michael Wallner <mike@php.net> * @license PHP License */ @@ -42,11 +42,11 @@ */ //ini_set('track_errors', true); -/** +/** * File_Gettext - * + * * GNU gettext file reader and writer. - * + * * ################################################################# * # All protected members of this class are public in its childs. # * ################################################################# @@ -54,15 +54,15 @@ * @author Michael Wallner <mike@php.net> * @version $Revision: 1.4 $ * @access public - * @package System.I18N.core + * @package System.I18N.core */ class TGettext { /** * strings - * + * * associative array with all [msgid => msgstr] entries - * + * * @access protected * @var array */ @@ -70,40 +70,40 @@ class TGettext /** * meta - * - * associative array containing meta + * + * associative array containing meta * information like project name or content type - * + * * @access protected * @var array */ protected $meta = array(); - + /** * file path - * + * * @access protected * @var string */ protected $file = ''; - + /** * Factory * * @static * @access public - * @return object Returns File_Gettext_PO or File_Gettext_MO on success + * @return object Returns File_Gettext_PO or File_Gettext_MO on success * or PEAR_Error on failure. * @param string $format MO or PO * @param string $file path to GNU gettext file */ - function factory($format, $file = '') + static function factory($format, $file = '') { $format = strToUpper($format); $filename = dirname(__FILE__).'/'.$format.'.php'; if(is_file($filename) == false) throw new Exception ("Class file $file not found"); - + include_once $filename; $class = 'TGettext_' . $format; @@ -115,35 +115,35 @@ class TGettext * * That's a simple fake of the 'msgfmt' console command. It reads the * contents of a GNU PO file and saves them to a GNU MO file. - * + * * @static * @access public * @return mixed Returns true on success or PEAR_Error on failure. * @param string $pofile path to GNU PO file * @param string $mofile path to GNU MO file */ - function poFile2moFile($pofile, $mofile) + static function poFile2moFile($pofile, $mofile) { if (!is_file($pofile)) { throw new Exception("File $pofile doesn't exist."); } - + include_once dirname(__FILE__).'/PO.php'; - + $PO = new TGettext_PO($pofile); if (true !== ($e = $PO->load())) { return $e; } - + $MO = $PO->toMO(); if (true !== ($e = $MO->save($mofile))) { return $e; } unset($PO, $MO); - + return true; } - + /** * prepare * @@ -153,7 +153,7 @@ class TGettext * @param string $string * @param bool $reverse */ - function prepare($string, $reverse = false) + static function prepare($string, $reverse = false) { if ($reverse) { $smap = array('"', "\n", "\t", "\r"); @@ -166,7 +166,7 @@ class TGettext return (string) str_replace($smap, $rmap, $string); } } - + /** * meta2array * @@ -175,7 +175,7 @@ class TGettext * @return array * @param string $meta */ - function meta2array($meta) + static function meta2array($meta) { $array = array(); foreach (explode("\n", $meta) as $info) { @@ -189,7 +189,7 @@ class TGettext /** * toArray - * + * * Returns meta info and strings as an array of a structure like that: * <code> * array( @@ -206,7 +206,7 @@ class TGettext * ) * ) * </code> - * + * * @see fromArray() * @access protected * @return array @@ -215,10 +215,10 @@ class TGettext { return array('meta' => $this->meta, 'strings' => $this->strings); } - + /** * fromArray - * + * * Assigns meta info and strings from an array of a structure like that: * <code> * array( @@ -235,7 +235,7 @@ class TGettext * ) * ) * </code> - * + * * @see toArray() * @access protected * @return bool @@ -255,7 +255,7 @@ class TGettext } return true; } - + /** * toMO * @@ -269,7 +269,7 @@ class TGettext $MO->fromArray($this->toArray()); return $MO; } - + /** * toPO * diff --git a/framework/I18N/core/MessageCache.php b/framework/I18N/core/MessageCache.php index 3bd21704..ad310258 100644 --- a/framework/I18N/core/MessageCache.php +++ b/framework/I18N/core/MessageCache.php @@ -2,7 +2,6 @@ /** * Translation table cache. * @author $Author: weizhuo $ - * @version $Id: MessageCache.php 3188 2012-07-12 12:13:23Z ctrlaltca $ * @package System.I18N.core */ @@ -16,9 +15,8 @@ require_once(dirname(__FILE__).'/TCache_Lite.php'); * It can cache each cataloug+variant or just the whole section. * @package System.I18N.core * @author $Author: weizhuo $ - * @version $Id: MessageCache.php 3188 2012-07-12 12:13:23Z ctrlaltca $ */ -class MessageCache +class MessageCache { /** @@ -31,16 +29,16 @@ class MessageCache * Caceh life time, default is 1 year. */ protected $lifetime = 3153600; - + /** * Create a new Translation cache. * @param string $cacheDir Directory to store the cache files. */ public function __construct($cacheDir) - { + { $cacheDir = $cacheDir.'/'; - + if(!is_dir($cacheDir)) throw new Exception( 'The cache directory '.$cacheDir.' does not exists.'. @@ -49,7 +47,7 @@ class MessageCache throw new Exception( 'The cache directory '.$cacheDir.' must be writable '. 'by the server.'); - + $options = array( 'cacheDir' => $cacheDir, 'lifeTime' => $this->getLifeTime(), @@ -102,31 +100,31 @@ class MessageCache * @param string $catalogue The translation section. * @param string $culture The translation locale, e.g. "en_AU". * @param string $filename If the source is a file, this file's modified - * time is newer than the cache's modified time, no cache hit. + * time is newer than the cache's modified time, no cache hit. * @return mixed Boolean FALSE if no cache hit. Otherwise, translation * table data for the specified section and locale. */ - public function get($catalogue, $culture, $lastmodified=0) + public function get($catalogue, $culture, $lastmodified=0) { $ID = $this->getID($catalogue, $culture); - $group = $this->getGroup($catalogue, $culture); + $group = $this->getGroup($catalogue, $culture); $this->cache->_setFileName($ID, $group); $cache = $this->cache->getCacheFile(); - - if(is_file($cache) == false) + + if(is_file($cache) == false) return false; $lastmodified = (int)$lastmodified; - + if($lastmodified <= 0 || $lastmodified > filemtime($cache)) - return false; - + return false; + //echo '@@ Cache hit: "'.$ID.'" : "'.$group.'"'; //echo "<br>\n"; - + return $this->cache->get($ID, $group); } @@ -136,28 +134,28 @@ class MessageCache * @param string $catalogue The translation section. * @param string $culture The translation locale, e.g. "en_AU". */ - public function save($data, $catalogue, $culture) - { + public function save($data, $catalogue, $culture) + { $ID = $this->getID($catalogue, $culture); - $group = $this->getGroup($catalogue, $culture); - + $group = $this->getGroup($catalogue, $culture); + //echo '## Cache save: "'.$ID.'" : "'.$group.'"'; //echo "<br>\n"; - + return $this->cache->save($data, $ID, $group); } - + /** * Clean up the cache for the specified section and locale. * @param string $catalogue The translation section. * @param string $culture The translation locale, e.g. "en_AU". */ - public function clean($catalogue, $culture) + public function clean($catalogue, $culture) { - $group = $this->getGroup($catalogue, $culture); + $group = $this->getGroup($catalogue, $culture); $this->cache->clean($group); } - + /** * Flush the cache. Deletes all the cache files. */ diff --git a/framework/I18N/core/TCache_Lite.php b/framework/I18N/core/TCache_Lite.php index a0629bd1..69e1c308 100644 --- a/framework/I18N/core/TCache_Lite.php +++ b/framework/I18N/core/TCache_Lite.php @@ -38,7 +38,6 @@ * Mike BENOIT <ipso@snappymail.ca> * * @package System.I18N.core -* @version $Id: TCache_Lite.php 3188 2012-07-12 12:13:23Z ctrlaltca $ * @author Fabien MARTY <fab@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL |