X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=I18n.php;h=6536b2f44e818249485c8f8343c6b82a736ff1aa;hp=d87210ffd930694f079e7320ec87f92554ae829c;hb=HEAD;hpb=896602f38d4cdb1ffff457cb2bb30d9ef410b886 diff --git a/I18n.php b/I18n.php index d87210ff..bab0b2d3 100644 --- a/I18n.php +++ b/I18n.php @@ -62,7 +62,7 @@ class Pman_Core_I18n extends Pman //return true; $au = $this->getAuthUser(); //if (!$au) { - // $this->jerr("Not authenticated", array('authFailure' => true)); + // $this->jerror("LOGIN-NOAUTH", "Not authenticated", array('authFailure' => true)); //} $this->authUser = $au; @@ -86,8 +86,7 @@ class Pman_Core_I18n extends Pman $this->sessionState(0); $lang = !$this->authUser || empty($this->authUser->lang ) ? 'en' : $this->authUser->lang; - - /// verify the selected language.. + /// verify the selected language.. $i = DB_DataObject::Factory('I18n'); $i->ltype = 'l'; // string(1) not_null multiple_key $i->lkey = $lang; // string(8) not_null @@ -107,7 +106,7 @@ class Pman_Core_I18n extends Pman return explode('_', $lang); } - function get($s ='') + function get($s ='', $opts=array()) { $this->sessionState(0); @@ -120,7 +119,7 @@ class Pman_Core_I18n extends Pman $i = DB_DataObject::Factory('I18n'); - + $i->is_active = 1; switch($s) { case 'Lang': @@ -189,7 +188,8 @@ class Pman_Core_I18n extends Pman foreach($langs as $lang) { //$rlang = array_shift(explode('_', strtoupper($lang))); - $rlang = array_shift(explode('_', $lang)); + $ll = explode('_', $lang); + $rlang = array_shift($ll); $ar[$lang] = array(); $i = DB_DataObject::Factory('I18n'); @@ -199,6 +199,10 @@ class Pman_Core_I18n extends Pman $i = DB_DataObject::Factory('I18n'); $ar[$lang]['m'] = $i->toTransList('m', $rlang); } + require_once 'I18Nv2/CurrencyMap.php'; + + $ar['currency_map'] = I18Nv2_CurrencyMap::$s_map; + //echo '
';print_r($ar);
         header('Content-type: text/javascript');
         echo "Roo.namespace('Pman.I18n');";
@@ -230,7 +234,18 @@ class Pman_Core_I18n extends Pman
         if (empty($k)) {
             return '??';
         }
-        $lang = !$au || empty($au->lang ) ? 'en' : is_string($au) ? $au : $au->lang;
+
+        if(class_exists('HTML_FlexyFramework2', false)) {
+            $fo = HTML_FlexyFramework2::get()->HTML_Template_Flexy;
+        }
+        else {
+            $fo = &PEAR::getStaticProperty('HTML_Template_Flexy','options');
+        }
+        
+        $fallback_lang = empty($fo['locale']) ? 'en' : $fo['locale'];
+            
+        
+        $lang =  empty($au ) ? $fallback_lang : (is_string($au) ? $au : $au->lang);
         
         // does it need caching?