protected function loadLocales() { //Set the default locale as the first one. $locales = Translation::groupBy('locale')->get()->pluck('locale'); if ($locales instanceof Collection) { $locales = $locales->all(); } $locales = array_merge([config('app.locale')], $locales); return array_unique($locales); }
protected function loadLocales() { //Set the default locale as the first one. $locales = Translation::groupBy('locale')->lists('locale'); if ($locales instanceof Collection) { $locales = $locales->all(); } $langs = Language::lists('code'); if ($langs instanceof Collection) { $langs = $langs->all(); } $locales = array_merge($locales, $langs); sort($locales); $locales = array_merge([config('app.locale')], $locales); return array_unique($locales); }
public function getIndex($group = null) { $locales = $this->loadLocales(); $groups = Translation::groupBy('group'); $excludedGroups = $this->manager->getConfig('exclude_groups'); if ($excludedGroups) { $groups->whereNotIn('group', $excludedGroups); } $groups = $groups->lists('group', 'group'); if ($groups instanceof Collection) { $groups = $groups->all(); } $groups = ['' => 'Select Group'] + $groups; $numChanged = Translation::where('group', $group)->where('status', Translation::STATUS_CHANGED)->count(); $allTranslations = Translation::where('group', $group)->orderBy('key', 'asc')->get(); $numTranslations = count($allTranslations); $translations = []; foreach ($allTranslations as $translation) { $translations[$translation->key][$translation->locale] = $translation; } return view('translation-manager::index')->with('translations', $translations)->with('locales', $locales)->with('groups', $groups)->with('group', $group)->with('numTranslations', $numTranslations)->with('numChanged', $numChanged)->with('editUrl', action('\\Barryvdh\\TranslationManager\\Controller@postEdit', [$group]))->with('deleteEnabled', $this->manager->getConfig('delete_enabled')); }
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; }
protected function loadLocales() { //Set the default locale as the first one. $locales = array_merge(array(Config::get('app.locale')), Translation::groupBy('locale')->lists('locale')); return array_unique($locales); }