Translations.php
authorAlan Knowles <alan@roojs.com>
Fri, 16 Aug 2013 05:57:27 +0000 (13:57 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 16 Aug 2013 05:57:27 +0000 (13:57 +0800)
Translations.php

index f41922f..92598d0 100644 (file)
@@ -41,21 +41,30 @@ class Pman_Admin_Translations extends Pman
     }
     
     
-    function get($path)
+    function get($module)
     {
         
-        if (!empty($path)) {
+        if (!empty($module)) {
             $this->init();
-            // output the translations strings file..
-            list($module, $lang) = explode('/',$path);
-                
-            $this->loadOriginalStrings($module);
             
-            $data = $this->loadTranslateDB($lang,$module);
             
-            $j = new Services_JSON();
-    
-            echo $j->stringify($data, null, 4);
+            $d = DB_DataObject::factory('translations');
+            $d->module = $module;
+            $d->selectAdd();
+            $d->selectAdd('distinct(tlang) as tlang');
+            $langs= $d->fetchAll('tlang');
+            foreach($langs as $lang) {
+                // output the translations strings file..
+                list($module, $lang) = explode('/',$path);
+                    
+                $this->loadOriginalStrings($module);
+                
+                $data = $this->loadTranslateDB($lang,$module);
+                
+                $j = new Services_JSON();
+                echo "_T.{$lang}= Roo.apply( _T.{$lang} || { }, " .  $j->stringify($data, null, 4) . ");\n";
+                
+            }
             exit;
             
         }