listEnabled() public static method

Lists the enabled locales, used on the front-end.
public static listEnabled ( ) : array
return array
コード例 #1
0
 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);
 }
コード例 #2
0
ファイル: Translator.php プロジェクト: janusnic/OctoberCMS
 /**
  * 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;
 }
コード例 #3
0
 public function onRun()
 {
     $this->page['activeLocale'] = $this->activeLocale = $this->translator->getLocale();
     $this->page['locales'] = $this->locales = LocaleModel::listEnabled();
 }
コード例 #4
0
ファイル: Locale.php プロジェクト: aydancoskun/octobercms
 /**
  * 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);
 }
コード例 #5
0
 public function getLanguageOptions($keyValue = null)
 {
     return array_merge(['' => trans('axc.framework::lang.system.any')], \RainLab\Translate\Models\Locale::listEnabled());
 }