summaryrefslogtreecommitdiff
path: root/framework/I18N/TGlobalization.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/I18N/TGlobalization.php')
-rw-r--r--framework/I18N/TGlobalization.php23
1 files changed, 15 insertions, 8 deletions
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<weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 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 '@@'
* </code>
* 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')
{