src/Twig/Extension/SonataAdminExtension.php
final public function getCanonicalizedLocaleForMoment(array $context)
    {
        $locale = strtolower(str_replace('_', '-', $context['app']->getRequest()->getLocale()));

        // "en" language doesn't require localization.
        if (('en' === $lang = substr($locale, 0, 2)) && !\in_array($locale, ['en-au', 'en-ca', 'en-gb', 'en-ie', 'en-nz'], true)) {
            return null;
        }

        foreach (self::MOMENT_UNSUPPORTED_LOCALES as $language => $locales) {
            if ($language === $lang && !\in_array($locale, $locales, true)) {
                $locale = $language;
            }
        }

        return $locale;
    }
final public function getCanonicalizedLocaleForMoment(array $context)
    {
        $locale = strtolower(str_replace('_', '-', $context['app']->getRequest()->getLocale()));

        // "en" language doesn't require localization.
        if (('en' === $lang = substr($locale, 0, 2)) && !\in_array($locale, ['en-au', 'en-ca', 'en-gb', 'en-ie', 'en-nz'], true)) {
            return null;
        }

        foreach (self::MOMENT_UNSUPPORTED_LOCALES as $language => $locales) {
            if ($language === $lang && !\in_array($locale, $locales, true)) {
                $locale = $language;
            }
        }

        return $locale;
    }
final public function getCanonicalizedLocaleForMoment ( array $ context ) { $ locale = strtolower ( str_replace ( '_' , '-' , $ context [ 'app' ] -> getRequest ( ) -> getLocale ( ) ) ) ; // "en" language doesn't require localization. if ( ( 'en' === $ lang = substr ( $ locale , 0 , 2 ) ) && ! \ in_array ( $ locale , [ 'en-au' , 'en-ca' , 'en-gb' , 'en-ie' , 'en-nz' ] , true ) ) { return null ; } foreach ( self :: MOMENT_UNSUPPORTED_LOCALES as $ language => $ locales ) { if ( $ language === $ lang && ! \ in_array ( $ locale , $ locales , true ) ) { $ locale = $ language ; } } return $ locale ; }
Returns a canonicalized locale for "moment" NPM library,
or `null` if the locale's language is "en", which doesn't require localization.

@return string|null
Returns a canonicalized locale for moment NPM library or null if the locale s language is en which doesn t require localization .