I18n.php
[Pman.Core] / I18n.php
index 7ec41cc..1d5bd68 100644 (file)
--- a/I18n.php
+++ b/I18n.php
@@ -69,7 +69,9 @@ class Pman_Core_I18N extends Pman
         $ff= HTML_FlexyFramework::get();
          
         
-        $opts = empty($ff->Pman_Core_I18N) ? (empty($ff->Pman_I18N) ? array() : $ff->Pman_I18N)  : $ff->Pman_Core_I18N;
+        $opts = empty($ff->Pman_Core_I18N) ?
+                (empty($ff->Pman_I18N) ? array() : $ff->Pman_I18N)
+                : $ff->Pman_Core_I18N;
         
          
         
@@ -88,6 +90,8 @@ class Pman_Core_I18N extends Pman
         $i->ltype = 'l';                           // string(1)  not_null multiple_key
         $i->lkey = $lang;                            // string(8)  not_null
         if (!$i->count()) {
+            
+            
             $this->jerr('invalid lang configured: ' . $lang);
         }
         
@@ -97,8 +101,7 @@ class Pman_Core_I18N extends Pman
      
     function get($s ='')
     {
-        $i = DB_DataObject::Factory('I18n');
-        $i->buildDb();
+     
      
         $lbits = $this->guessUsersLanguage();
          
@@ -113,22 +116,24 @@ class Pman_Core_I18N extends Pman
                 break;
 
             case 'Country':
-                $i->ltype = 'l';
+                $i->ltype = 'c';
                 $i->applyFilters($_REQUEST, $this->authUser, $this);
-                $this->jdata($i->toTransList('l',  $lbits[0]));
+                $this->jdata($i->toTransList('c',  $lbits[0]));
                 
                 $ret = $this->getList('c', $lbits[0],empty($_REQUEST['filter']) ? false : $_REQUEST['filter']);
                 break;
                 
              case 'Currency':
-                $i->ltype = 'l';
+                $i->ltype = 'm';
                 $i->applyFilters($_REQUEST, $this->authUser, $this);
-                $this->jdata($i->toTransList('l',  $lbits[0]));
+                $this->jdata($i->toTransList('m',  $lbits[0]));
                 break;
              
                 
         }
-          
+        
+        $i = DB_DataObject::Factory('I18n');
+        $i->buildDb();
       
        
         $i = DB_DataObject::Factory('I18n');
@@ -140,11 +145,13 @@ class Pman_Core_I18N extends Pman
         {
             $rlang = array_shift(explode('_', strtoupper($lang)));
             
-            $ar[$lang] = array(
-                'l' => $i->toTransList('l',  $rlang),
-                'c' => $i->toTransList('c', $rlang),
-                'm' => $i->toTransList('m', $rlang),
-            );
+            $ar[$lang] = array();
+            $i = DB_DataObject::Factory('I18n');
+            $ar[$lang]['l'] = $i->toTransList('l',  $rlang);
+            $i = DB_DataObject::Factory('I18n');
+            $ar[$lang]['c'] =  $i->toTransList('c', $rlang);
+            $i = DB_DataObject::Factory('I18n');
+            $ar[$lang]['m'] = $i->toTransList('m', $rlang);
         }
         //echo '<PRE>';print_r($ar);
         header('Content-type: text/javascript');