Contao\CoreBundle\EventListener\LocaleListener::formatLocaleId PHP Метод

formatLocaleId() приватный Метод

Formats a string to represent a locale ID.
private formatLocaleId ( string $locale ) : string
$locale string
Результат string
    private function formatLocaleId($locale)
    {
        if (!preg_match('/^[a-z]{2}([_-][a-z]{2})?$/i', $locale)) {
            throw new \InvalidArgumentException(sprintf('"%s" is not a supported locale.', $locale));
        }
        $values = preg_split('/-|_/', $locale);
        $locale = strtolower($values[0]);
        if (isset($values[1])) {
            $locale .= '_' . strtoupper($values[1]);
        }
        return $locale;
    }