Browse Source

[GENERIC] Zend_View_Helper_Translate:

- added support for application wide translation usage

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18465 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas 16 years ago
parent
commit
5f572062db
1 changed files with 8 additions and 1 deletions
  1. 8 1
      library/Zend/View/Helper/Translate.php

+ 8 - 1
library/Zend/View/Helper/Translate.php

@@ -50,7 +50,14 @@ class Zend_View_Helper_Translate extends Zend_View_Helper_Abstract
      */
     public function __construct($translate = null)
     {
-        if (empty($translate) === false) {
+        if ($translate === null) {
+            require_once 'Zend/Registry.php';
+            if (Zend_Registry::isRegistered('Zend_Translate')) {
+                $translate = Zend_Registry::get('Zend_Translate');
+            }
+        }
+
+        if ($translate !== null) {
             $this->setTranslator($translate);
         }
     }