public function getEmpty($group, $locale, $key) { $translation = Translation::where('group_id', $group)->where('locale_id', $locale)->where('key', $key)->first(); $translation->value = null; $translation->save(); return back(); }
public function exportTranslations($group) { if ($group == '*') { return $this->exportAllTranslations(); } $g = Group::find($group); if (!in_array($g->label, $this->config['exclude_groups'])) { $tree = $this->makeTree(Translation::where('group_id', $g->id)->whereNotNull('value')->get()); foreach ($tree as $locale => $groups) { $filename = $g->label; if (isset($groups[$g->label])) { if (str_contains($g->label, '/')) { $groupPath = $g->label; $filename = basename($groupPath); $folder = dirname($groupPath); $directoryPath = $this->app->langPath() . '/' . $locale . '/' . $folder; if (!$this->files->exists($directoryPath)) { $this->files->makeDirectory($directoryPath, 493, true, true); } $path = $this->app->langPath() . "/{$locale}/{$folder}/{$filename}.php"; } else { $path = $this->app->langPath() . "/{$locale}/{$filename}.php"; } $translations = $groups[$g->label]; $path = $this->app->langPath() . '/' . $locale . '/' . $g->label . '.php'; $output = "<?php\n\nreturn " . var_export($translations, true) . ";\n"; $this->files->put($path, $output); } } Translation::where('group_id', $g->id)->whereNotNull('value')->update(array('status' => Translation::STATUS_SAVED)); } }