DataObjects/Core_template.php
authorAlan Knowles <alan@roojs.com>
Fri, 4 Dec 2020 04:53:42 +0000 (12:53 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 4 Dec 2020 04:53:42 +0000 (12:53 +0800)
DataObjects/Core_template.php

index 3f50a25..c9772e2 100644 (file)
@@ -437,7 +437,7 @@ WHERE (
         }
         $lang = $lang ? $lang : $ff->locale;
         $fdir = "{$compileDir}/{$lang}/LC_MESSAGES";
-        $fname = "{$fdir}/{$clsname}.po";
+        $fname = "{$fdir}/{$clsname}.mo";
         
         var_dump( "
                setlocale(LC_MESSAGES, $lang); 
@@ -480,7 +480,7 @@ WHERE (
         }
         
         require_once 'File/Gettext.php';
-        $gt = File_Gettext::factory('PO', $fname);
+        $gt = File_Gettext::factory('PO', preg_replace('/\.mo$/', '.po', $fname));
         $gt->fromArray(
             
             array(
@@ -495,7 +495,22 @@ WHERE (
             
         );
         $gt->save();
-          
+        require_once 'File/Gettext.php';
+        $gt = File_Gettext::factory('MO', $fname);
+        $gt->fromArray(
+            
+            array(
+                'meta' => array(
+                    'Content-Type'      => 'text/plain; charset=UTF-8\n',
+                    //'Last-Translator'   => 'Michael Wallner <mike@iworks.at>',
+                    'PO-Revision-Date'  => date('Y-m-d H:iO'),
+                    //'Language-Team'     => 'German <mail@example.com>',
+                ),
+                'strings' => $words
+            )
+            
+        );
+        $gt->save(); 
         
     }
 }
\ No newline at end of file