/** * Show list of all or selected translation */ public function get($file = 'all') { $translation = new Translation(); $files = $translation->getFiles(); if (!in_array($file, $files)) { $file = 'all'; } $trans = $translation->getAll($file); $filesWithAll = array_merge(['all'], $files); $languages = $translation->getLanguages(); $lastModified = $translation->lastModified($file); return ['translations' => $trans, 'files' => $filesWithAll, 'selected' => $file, 'languages' => $languages, 'lastModified' => $lastModified]; }
/** * Run the database seeds. * * @return void */ public function run() { $translation = new Translation(); $all = $translation->getAll('all'); $trans = []; foreach ($translation->getLanguages() as $lang) { $trans[$lang] = []; foreach ($all as $item) { $trans[$lang][$item->key] = $item->trans[$lang]; } } $translation->saveForm($trans); }