Пример #1
0
 public function __construct($route)
 {
     parent::__construct($route);
     $this->langModel = LangModel::getInstance();
     $this->langsModel = LangsModel::getInstance();
     $this->route->get('/json')->get('/json_var')->get('/php_array')->get('/csv')->get('/i18n');
 }
Пример #2
0
 public function toi18n()
 {
     return $this->createZip(function ($dir) {
         $paths = array();
         $path = 'nls/app.js';
         $file = $dir . "/" . $path;
         $data = array();
         for ($i = 1; $i < count($this->langs); $i++) {
             $data[$this->langs[$i]->code] = true;
         }
         $data['root'] = array();
         $this->writeFile($file, 'define(' . json_encode($data, JSON_PRETTY_PRINT) . ');');
         $paths[] = $path;
         foreach ($this->langs as $lang) {
             $path = "nls/{$lang->code}/app.js";
             $file = $dir . "/" . $path;
             $data = $this->langsModel->getTexts($lang->id);
             $this->writeFile($file, 'define(' . json_encode($data, JSON_PRETTY_PRINT) . ');');
             $paths[] = $path;
         }
         return $paths;
     });
 }