public function postDelete($group, $sub_group = null, $key) { if (!in_array($group, $this->manager->getConfig('exclude_groups')) && $this->manager->getConfig('delete_enabled')) { Translation::where('group', $group)->where('key', $key)->delete(); return ['status' => 'ok']; } }
public function postManage($language_id, $group) { $language = TranslationLanguage::findOrFail($language_id); $input = Input::all(); unset($input['_token']); foreach ($input as $key => $value) { $translation = Translation::where('locale', $language->code)->where('key', $key)->first(); if ($translation) { $value = str_replace('**script**', '<script>', $value); $value = str_replace('**/script**', '</script>', $value); $translation->value = $value; $translation->save(); } } $this->translation_manager->exportTranslations($group); return Redirect::route("{$this->link_type}.modules.doptor.translation_manager.index", [$language_id])->with('success_message', 'The translations were changed.'); }
public function postDelete() { $groups = func_get_args(); $key = array_pop($groups); // the last arg is the key $group = implode('/', $groups); if (!in_array($group, $this->manager->getConfig('exclude_groups')) && $this->manager->getConfig('delete_enabled')) { Translation::where('group', $group)->where('key', $key)->delete(); return ['status' => 'ok']; } }
public function truncateTranslations() { Translation::truncate(); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $language = TranslationLanguage::findOrFail($id); $language_path = base_path() . '/resources/lang/' . $language->code; if (File::exists($language_path)) { File::deleteDirectory($language_path); } // Delete the translations for the language Translation::where('locale', $language->code)->delete(); if ($language->delete()) { return Redirect::route("{$this->link_type}.modules.doptor.translation_manager.languages.index")->with('success_message', trans('success_messages.translate_lang_delete')); } else { return Redirect::route("{$this->link_type}.modules.doptor.translation_manager.languages.index")->with('error_message', trans('error_messages.translate_lang_delete')); } }
public function getLocales() { if (empty($this->locales)) { $locales = array_merge([config('app.locale')], Translation::groupBy('locale')->lists('locale')->all()); foreach ($this->files->directories($this->app->langPath()) as $localeDir) { $locales[] = $this->files->name($localeDir); } $this->locales = array_unique($locales); sort($this->locales); } return $this->locales; }