public function onRun() { if ($redirect = $this->redirectForceUrl()) { return $redirect; } $this->page['locales'] = $this->locales = LocaleModel::listEnabled(); $this->page['activeLocale'] = $this->activeLocale = $this->translator->getLocale(); $this->page['activeLocaleName'] = $this->activeLocaleName = array_get($this->locales, $this->activeLocale); }
/** * Changes the locale in the application and optionally stores it in the session. * @param string $locale Locale to use * @param boolean $remember Set to false to not store in the session. * @return boolean Returns true if the locale exists and is set. */ public function setLocale($locale, $remember = true) { $languages = array_keys(Locale::listEnabled()); if (in_array($locale, $languages)) { App::setLocale($locale); $this->activeLocale = $locale; if ($remember) { $this->setSessionLocale($locale); } return true; } return false; }
public function onRun() { $this->page['activeLocale'] = $this->activeLocale = $this->translator->getLocale(); $this->page['locales'] = $this->locales = LocaleModel::listEnabled(); }
/** * Returns true if the supplied locale is valid. * @return boolean */ public static function isValid($locale) { $languages = array_keys(Locale::listEnabled()); return in_array($locale, $languages); }
public function getLanguageOptions($keyValue = null) { return array_merge(['' => trans('axc.framework::lang.system.any')], \RainLab\Translate\Models\Locale::listEnabled()); }