From 485c88300e852452421ac5686934b75252657636 Mon Sep 17 00:00:00 2001 From: tof <> Date: Mon, 10 Mar 2008 15:33:19 +0000 Subject: Fixed a PHP Notice introduced by Changeset [2394] --- framework/I18N/Translation.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'framework/I18N/Translation.php') 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; + } } } -- cgit v1.2.3