src/PeskyCMF/Config/CmfConfig.php
static public function getLocaleWithSuffix($separator = '_', $lowercased = false): ?string {
        $locale = preg_split('%[-_]%', strtolower(app()->getLocale()));
        if (count($locale) === 2) {
            return $locale[0] . $separator . ($lowercased ? $locale[1] : strtoupper($locale[1]));
        } else {
            $localeSuffix = isset(static::$localeSuffixMap[$locale[0]]) ? static::$localeSuffixMap[$locale[0]] : $locale[0];
            return $locale[0] . $separator . ($lowercased ? $localeSuffix : strtoupper($localeSuffix));
        }
    }
static public function getLocaleWithSuffix($separator = '_', $lowercased = false): ?string {
        $locale = preg_split('%[-_]%', strtolower(app()->getLocale()));
        if (count($locale) === 2) {
            return $locale[0] . $separator . ($lowercased ? $locale[1] : strtoupper($locale[1]));
        } else {
            $localeSuffix = isset(static::$localeSuffixMap[$locale[0]]) ? static::$localeSuffixMap[$locale[0]] : $locale[0];
            return $locale[0] . $separator . ($lowercased ? $localeSuffix : strtoupper($localeSuffix));
        }
    }
static public function getLocaleWithSuffix ( $ separator = '_' , $ lowercased = false ) : ? string { $ locale = preg_split ( '%[-_]%' , strtolower ( app ( ) -> getLocale ( ) ) ) ; if ( count ( $ locale ) === 2 ) { return $ locale [ 0 ] . $ separator . ( $ lowercased ? $ locale [ 1 ] : strtoupper ( $ locale [ 1 ] ) ) ; } else { $ localeSuffix = isset ( static :: $ localeSuffixMap [ $ locale [ 0 ] ] ) ? static :: $ localeSuffixMap [ $ locale [ 0 ] ] : $ locale [ 0 ] ; return $ locale [ 0 ] . $ separator . ( $ lowercased ? $ localeSuffix : strtoupper ( $ localeSuffix ) ) ; } }
Get locale in format "en_US" or "ru-RU" or "it-it"
@param string $separator
@param bool $lowercased - true: will return "it-it" instead of "it-IT"
@return string
Get locale in format en_US or ru - RU or it - it