src/Model/Locale.php
public static function getByLocale($locale)
    {
        if (!$locale) {
            return null;
        }

        if ($locale instanceof Locale) {
            return $locale;
        }

        if (!static::$locales_by_title) {
            static::$locales_by_title = [];
            foreach (Locale::getCached() as $localeObj) {
                static::$locales_by_title[$localeObj->Locale] = $localeObj;
            }
        }

        // Get filtered locale
        return isset(static::$locales_by_title[$locale]) ? static::$locales_by_title[$locale] : null;
    }
public static function getByLocale($locale)
    {
        if (!$locale) {
            return null;
        }

        if ($locale instanceof Locale) {
            return $locale;
        }

        if (!static::$locales_by_title) {
            static::$locales_by_title = [];
            foreach (Locale::getCached() as $localeObj) {
                static::$locales_by_title[$localeObj->Locale] = $localeObj;
            }
        }

        // Get filtered locale
        return isset(static::$locales_by_title[$locale]) ? static::$locales_by_title[$locale] : null;
    }
public static function getByLocale ( $ locale ) { if ( ! $ locale ) { return null ; } if ( $ locale instanceof Locale ) { return $ locale ; } if ( ! static :: $ locales_by_title ) { static :: $ locales_by_title = [ ] ; foreach ( Locale :: getCached ( ) as $ localeObj ) { static :: $ locales_by_title [ $ localeObj -> Locale ] = $ localeObj ; } } // Get filtered locale return isset ( static :: $ locales_by_title [ $ locale ] ) ? static :: $ locales_by_title [ $ locale ] : null ; }
Get object by locale code.

@param string|Locale $locale
@return Locale
Get object by locale code .