Module: nagvis
Branch: master
Commit: dfdf0d9165e5c9869af7d3895c1014ad15e1dbc7
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=dfdf0d9165e5c9869af7d3895c1014ad15e1dbc7

Author: LaMi <[email protected]>
Date:   Wed Mar 31 12:42:10 2010 +0200

Added some debug outputs to translation/gettext code

---

 share/server/core/classes/GlobalLanguage.php       |   11 +++++++++-
 share/server/core/defines/global.php               |    2 +-
 .../server/core/ext/php-gettext-1.0.9/gettext.inc  |   21 +++++++++++++------
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/share/server/core/classes/GlobalLanguage.php 
b/share/server/core/classes/GlobalLanguage.php
index 75cc088..44707c9 100644
--- a/share/server/core/classes/GlobalLanguage.php
+++ b/share/server/core/classes/GlobalLanguage.php
@@ -67,8 +67,17 @@ class GlobalLanguage {
                
                T_bindtextdomain($this->textDomain, 
$this->CORE->getMainCfg()->getValue('paths', 'language'));
                T_bind_textdomain_codeset($this->textDomain, 
$this->sCurrentEncoding);
-
+               
                T_textdomain($this->textDomain);
+               
+               // Check if native gettext or php-gettext is used
+               if(DEBUG&&DEBUGLEVEL&2) {
+                       if(locale_emulation()) {
+                               debug('GlobalLanguage: Using php-gettext for 
translations');
+                       } else {
+                               debug('GlobalLanguage: Using native gettext for 
translations');
+                       }
+               }
        }
        
        /**
diff --git a/share/server/core/defines/global.php 
b/share/server/core/defines/global.php
index 6d7c9e2..5903881 100644
--- a/share/server/core/defines/global.php
+++ b/share/server/core/defines/global.php
@@ -47,7 +47,7 @@ define('DEBUG', true);
  * 2: progress information in the functions
  * 4: render time
  */
-define('DEBUGLEVEL', 4);
+define('DEBUGLEVEL', 6);
 
 // Path to the debug file
 define('DEBUGFILE', '../../../var/nagvis-debug.log');
diff --git a/share/server/core/ext/php-gettext-1.0.9/gettext.inc 
b/share/server/core/ext/php-gettext-1.0.9/gettext.inc
index 6e182ba..d8c52f4 100644
--- a/share/server/core/ext/php-gettext-1.0.9/gettext.inc
+++ b/share/server/core/ext/php-gettext-1.0.9/gettext.inc
@@ -112,7 +112,7 @@ function _get_reader($domain=null, $category=5, 
$enable_cache=true) {
  */
 function locale_emulation() {
     global $EMULATEGETTEXT;
-    return $EMULATEGETTEXT;
+    return ($EMULATEGETTEXT == 1);
 }
 
 /**
@@ -120,7 +120,7 @@ function locale_emulation() {
  */
 function _check_locale() {
     global $EMULATEGETTEXT;
-    return !$EMULATEGETTEXT;
+    return !($EMULATEGETTEXT == 1);
 }
 
 /**
@@ -165,16 +165,23 @@ function _setlocale($category, $locale) {
             return _setlocale($category, $CURRENTLOCALE);
     } else {
         $ret = 0;
-        if (function_exists('setlocale')) // I don't know if this ever happens 
;)
+        if (function_exists('setlocale')) { // I don't know if this ever 
happens ;)
+           if(DEBUG&&DEBUGLEVEL&2) debug('php-gettext: params: category: 
'.$category.' locale: '.$locale);
            $ret = setlocale($category, $locale);
+           if(DEBUG&&DEBUGLEVEL&2) debug('php-gettext: setlocale exists: 
'.$ret);
+        }
+        
         if (($ret and $locale == '') or ($ret == $locale)) {
+                                               if(DEBUG&&DEBUGLEVEL&2) 
debug('php-gettext: using native gettext');
             $EMULATEGETTEXT = 0;
             $CURRENTLOCALE = $ret;
         } else {
-          if ($locale == '') // emulate variable support
-             $CURRENTLOCALE = getenv('LANG');
-        else
-            $CURRENTLOCALE = $locale;
+                                               if(DEBUG&&DEBUGLEVEL&2) 
debug('php-gettext: using emulated gettext');
+            if ($locale == '') // emulate variable support
+                $CURRENTLOCALE = getenv('LANG');
+            else
+                $CURRENTLOCALE = $locale;
+
             $EMULATEGETTEXT = 1;
         }
         // Allow locale to be changed on the go for one translation domain.


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to