summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
+ }
}
}