summaryrefslogtreecommitdiff
path: root/framework/I18N
diff options
context:
space:
mode:
authorcarlgmathisen <>2008-12-07 13:05:05 +0000
committercarlgmathisen <>2008-12-07 13:05:05 +0000
commit736e92efbc75908a2bf26fe333a03990e3bb8100 (patch)
tree21dfe413b2f3f52704ca28e17f22269f9cfdb5ea /framework/I18N
parent6228873cf9d6471463d2413e7dfd7447f759baf2 (diff)
work on php style configuration
Diffstat (limited to 'framework/I18N')
-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')
{