From 736e92efbc75908a2bf26fe333a03990e3bb8100 Mon Sep 17 00:00:00 2001 From: carlgmathisen <> Date: Sun, 7 Dec 2008 13:05:05 +0000 Subject: work on php style configuration --- framework/I18N/TGlobalization.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'framework/I18N/TGlobalization.php') diff --git a/framework/I18N/TGlobalization.php b/framework/I18N/TGlobalization.php index 1d158ce9..7a7dce00 100644 --- a/framework/I18N/TGlobalization.php +++ b/framework/I18N/TGlobalization.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.I18N @@ -62,20 +62,27 @@ class TGlobalization extends TModule * You should override this method if you want a different way of * setting the Culture and/or Charset for your application. * If you override this method, call parent::init($xml) first. - * @param TXmlElement application configuration + * @param mixed application configuration */ - public function init($xml) + public function init($config) { if($this->_charset===null) $this->_charset=$this->getDefaultCharset(); if($this->_culture===null) $this->_culture=$this->getDefaultCulture(); - if($xml!==null) + if($config!==null) { - $translation = $xml->getElementByTagName('translation'); + if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) + $translation = isset($config['translate'])?$config['translate']:null; + else + { + $t = $config->getElementByTagName('translation'); + if($t) + $translation = $t->getAttributes(); + } if($translation) - $this->setTranslationConfiguration($translation->getAttributes()); + $this->setTranslationConfiguration($translation); } $this->getApplication()->setGlobalization($this); } @@ -165,9 +172,9 @@ class TGlobalization extends TModule * $config['marker'] = '@@'; // surround untranslated text with '@@' * * Throws exception is source is not found. - * @param TMap configuration options + * @param TMap|array configuration options */ - protected function setTranslationConfiguration(TMap $config) + protected function setTranslationConfiguration($config) { if($config['type'] == 'XLIFF' || $config['type'] == 'gettext') { -- cgit v1.2.3