From ed3e43d30524a76969fb7d42cb5e613c2e1a1d9a Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 6 Jan 2006 05:16:25 +0000 Subject: Changing property scopes in TGlobalization --- framework/I18N/TGlobalization.php | 47 +++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 9 deletions(-) (limited to 'framework/I18N/TGlobalization.php') diff --git a/framework/I18N/TGlobalization.php b/framework/I18N/TGlobalization.php index 473fe315..4e6d030c 100644 --- a/framework/I18N/TGlobalization.php +++ b/framework/I18N/TGlobalization.php @@ -54,19 +54,19 @@ class TGlobalization extends TModule * The current charset. * @var string */ - public $Charset='UTF-8'; + protected $_charset='UTF-8'; /** * The current culture. * @var string */ - public $Culture='en'; + protected $_culture='en'; /** * The content type for the http header * @var string */ - public $ContentType='text/html'; + protected $_contentType='text/html'; /** * Initialize the Culture and Charset for this application. @@ -76,17 +76,46 @@ class TGlobalization extends TModule * @param TXmlElement application configuration */ public function init($xml) - { - $this->Culture = str_replace('-','_',$this->Culture); - $this->_defaultContentType = $this->ContentType; - $this->_defaultCharset = $this->Charset; - $this->_defaultCulture = $this->Culture; + { + $this->_defaultContentType = $this->getContentType(); + $this->_defaultCharset = $this->getCharset(); + $this->_defaultCulture = $this->getCulture(); $config = $xml->getElementByTagName('translation')->getAttributes(); $this->setTranslationConfiguration($config); $this->getApplication()->setGlobalization($this); } + public function getCulture() + { + return $this->_culture; + } + + public function setCulture($culture) + { + $this->_culture = str_replace('-','_',$culture); + } + + public function getCharset() + { + return $this->_charset; + } + + public function setCharset($charset) + { + $this->_charset = $charset; + } + + public function setContentType($type) + { + $this->_contentType = $type; + } + + public function getContentType() + { + return $this->_contentType; + } + /** * @return TMap translation source configuration. */ @@ -153,7 +182,7 @@ class TGlobalization extends TModule */ public function getCultureVariants($culture=null) { - if(is_null($culture)) $culture = $this->Culture; + if(is_null($culture)) $culture = $this->getCulture(); $variants = explode('_', $culture); $result = array(); for(; count($variants) > 0; array_pop($variants)) -- cgit v1.2.3