Database errors should be sent to log instead of screen in debug mode.
[fa-stable.git] / includes / lang / gettext.php
index 3023e9363020ebd4d8fdd2558198af73d5513cf1..72f246001c8ac6304f63f191a283d672c9ef8ec7 100644 (file)
@@ -26,19 +26,19 @@ define('GETTEXT_NATIVE', 1);
 define('GETTEXT_PHP', 2);
 
 function get_text_init($managerType = GETTEXT_NATIVE) {
-
-       if (!isset($_SESSION['get_text'])) {
+       global $GetText;
+       if (!isset($GetText)) {
 
         if ($managerType == GETTEXT_NATIVE) 
         {
             if (function_exists('gettext')) 
             {
-                $_SESSION['get_text'] = new gettext_native_support();
+                $GetText = new gettext_native_support();
                 return;
             }
         }
         // fail back to php support 
-               $_SESSION['get_text'] = new gettext_php_support();
+               $GetText = new gettext_php_support();
        }
 }
 
@@ -190,7 +190,7 @@ class gettext_native_support
      */
     function gettext($key)
     {
-        $value = $this->_get_translation($key);
+       $value = $this->_get_translation($key);
         if ($value === false) {
             $str = sprintf('Unable to locate gettext key "%s"', $key);
             //$err = new GetText_Error($str);
@@ -320,7 +320,7 @@ class gettext_php_support extends gettext_native_support
             $this->_jobs[] = array($domain, $path); 
             return;
         }
-        // Don't fill the domains with false data
+        // Don't fill the domains with false data, it increased the error.log
                if (strpos($domain, $this->_lang_code) === false)
                return;
  
@@ -360,7 +360,6 @@ class gettext_php_support extends gettext_native_support
         $d = new gettext_domain();
         $d->name = $domain;
         $d->path = $path;
-        
         if (!file_exists($php_domain) || (filemtime($php_domain) < filemtime($src_domain))) 
         {
             
@@ -553,7 +552,7 @@ class gettext_php_support_compiler
        Set current gettext domain path
 */
 function set_ext_domain($path='') {
-       global $path_to_root;
+       global $path_to_root, $GetText;
        static $domain_stack = array('');
 
        if ($path)      // save path on domain stack
@@ -565,9 +564,9 @@ function set_ext_domain($path='') {
        }
 
        $lang_path = $path_to_root . ($path ? '/' : '') .$path.'/lang';
-       // ignore change when extension does not provide translation structure and test for valid session.
-       if (file_exists($lang_path) && isset($_SESSION['get_text']))
-               $_SESSION['get_text']->add_domain($_SESSION['language']->code,
+       // ignore change when extension does not provide translation structure and test for valid gettext.
+       if (file_exists($lang_path) && isset($GetText))
+               $GetText->add_domain($_SESSION['language']->code,
                        $lang_path, $path ? '' : $_SESSION['language']->version);
 }
 ?>