public static function findMainCode($localeCodes)
    {
        $languageLocaleCodes = [];
        foreach ($localeCodes as $localeCode) {
            $languageCode = static::languageCode($localeCode);
            if (!isset($languageLocaleCodes[$languageCode])) {
                $languageLocaleCodes[$languageCode] = $localeCode;
            }
        }

        if ($mainLanguageCode = Language::findMainCode(array_keys($languageLocaleCodes))) {
            return $languageLocaleCodes[$mainLanguageCode];
        }

        return null;
    }
public static function findMainCode($localeCodes)
    {
        $languageLocaleCodes = [];
        foreach ($localeCodes as $localeCode) {
            $languageCode = static::languageCode($localeCode);
            if (!isset($languageLocaleCodes[$languageCode])) {
                $languageLocaleCodes[$languageCode] = $localeCode;
            }
        }

        if ($mainLanguageCode = Language::findMainCode(array_keys($languageLocaleCodes))) {
            return $languageLocaleCodes[$mainLanguageCode];
        }

        return null;
    }
public static function findMainCode ( $ localeCodes ) { $ languageLocaleCodes = [ ] ; foreach ( $ localeCodes as $ localeCode ) { $ languageCode = static :: languageCode ( $ localeCode ) ; if ( ! isset ( $ languageLocaleCodes [ $ languageCode ] ) ) { $ languageLocaleCodes [ $ languageCode ] = $ localeCode ; } } if ( $ mainLanguageCode = Language :: findMainCode ( array_keys ( $ languageLocaleCodes ) ) ) { return $ languageLocaleCodes [ $ mainLanguageCode ] ; } return null ; }
Find main locale code in a list
@param string[] $localeCodes the list of locale codes
@return string|null main locale code (using RFC 4646 language tags) or null
Find main locale code in a list