src/Sulu/Component/Localization/Localization.php
public static function createFromString($locale, $format = self::UNDERSCORE)
    {
        $delimiter = '-';
        if (in_array($format, [self::UNDERSCORE, self::LCID])) {
            $delimiter = '_';
        }

        $parts = explode($delimiter, $locale);

        $localization = new self();
        $localization->setLanguage(strtolower($parts[0]));
        if (count($parts) > 1) {
            $localization->setCountry(strtolower($parts[1]));
        }

        return $localization;
    }
public static function createFromString($locale, $format = self::UNDERSCORE)
    {
        $delimiter = '-';
        if (in_array($format, [self::UNDERSCORE, self::LCID])) {
            $delimiter = '_';
        }

        $parts = explode($delimiter, $locale);

        $localization = new self();
        $localization->setLanguage(strtolower($parts[0]));
        if (count($parts) > 1) {
            $localization->setCountry(strtolower($parts[1]));
        }

        return $localization;
    }
public static function createFromString ( $ locale , $ format = self :: UNDERSCORE ) { $ delimiter = '-' ; if ( in_array ( $ format , [ self :: UNDERSCORE , self :: LCID ] ) ) { $ delimiter = '_' ; } $ parts = explode ( $ delimiter , $ locale ) ; $ localization = new self ( ) ; $ localization -> setLanguage ( strtolower ( $ parts [ 0 ] ) ) ; if ( count ( $ parts ) > 1 ) { $ localization -> setCountry ( strtolower ( $ parts [ 1 ] ) ) ; } return $ localization ; }
Create an instance of localization for given locale.

@param string $locale
@param string $format

@return Localization
Create an instance of localization for given locale .