Mcamara\LaravelLocalization\LaravelLocalization::checkLocaleInSupportedLocales PHP Method

checkLocaleInSupportedLocales() public method

Check if Locale exists on the supported locales array
public checkLocaleInSupportedLocales ( string | boolean $locale ) : boolean
$locale string | boolean string|bool Locale to be checked
return boolean is the locale supported?
    public function checkLocaleInSupportedLocales($locale)
    {
        $locales = $this->getSupportedLocales();
        if ($locale !== false && empty($locales[$locale])) {
            return false;
        }
        return true;
    }

Usage Example

Example #1
0
 /**
  * Check if Locale exists on the supported locales array
  *
  * @param string|boolean $locale string|bool Locale to be checked
  * @throws SupportedLocalesNotDefined
  * @return boolean is the locale supported?
  * @static 
  */
 public static function checkLocaleInSupportedLocales($locale)
 {
     return \Mcamara\LaravelLocalization\LaravelLocalization::checkLocaleInSupportedLocales($locale);
 }