summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortof <>2008-03-10 15:33:19 +0000
committertof <>2008-03-10 15:33:19 +0000
commit485c88300e852452421ac5686934b75252657636 (patch)
tree5a201b35452c01051e82a8ed9dffd96da4adc2a8
parent32de1043b12a1e4d515e14359916944c1505d48b (diff)
Fixed a PHP Notice introduced by Changeset [2394]
-rw-r--r--framework/I18N/Translation.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/framework/I18N/Translation.php b/framework/I18N/Translation.php
index 60e55ba0..a7250dad 100644
--- a/framework/I18N/Translation.php
+++ b/framework/I18N/Translation.php
@@ -39,8 +39,10 @@ class Translation extends TComponent
*/
public static function init($catalogue='messages')
{
+ static $saveEventHandlerAttached=false;
+
//initialized the default class wide formatter
- if(is_null(self::$formatters[$catalogue]))
+ if(!isset(self::$formatters[$catalogue]))
{
$app = Prado::getApplication()->getGlobalization();
$config = $app->getTranslationConfiguration();
@@ -59,9 +61,14 @@ class Translation extends TComponent
if($ps=$config['marker'])
self::$formatters[$catalogue]->setUntranslatedPS(array($ps,$ps));
- //save the message on end request
- Prado::getApplication()->attachEventHandler(
- 'OnEndRequest', array('Translation', 'saveMessages'));
+ //save the message on end request
+ // Do it only once !
+ if (!$saveEventHandlerAttached)
+ {
+ Prado::getApplication()->attachEventHandler(
+ 'OnEndRequest', array('Translation', 'saveMessages'));
+ $saveEventHandlerAttached=true;
+ }
}
}