src/Utilities/Locale.php
public static function setLocale($category, $languageCode, $countryCode = '')
    {
        $category = (int)$category;

        if (is_string($languageCode)) {
            $languageCode = trim($languageCode);
        }

        $availableCategories = [
            LC_ALL,
            LC_COLLATE,
            LC_CTYPE,
            LC_MONETARY,
            LC_NUMERIC,
            LC_TIME,
            LC_MESSAGES,
        ];

        if (empty($languageCode) || !in_array($category, $availableCategories, true)) {
            return false;
        }

        $localeLongForm = self::getLongForm($languageCode, $countryCode);

        return setlocale($category, $localeLongForm);
    }
public static function setLocale($category, $languageCode, $countryCode = '')
    {
        $category = (int)$category;

        if (is_string($languageCode)) {
            $languageCode = trim($languageCode);
        }

        $availableCategories = [
            LC_ALL,
            LC_COLLATE,
            LC_CTYPE,
            LC_MONETARY,
            LC_NUMERIC,
            LC_TIME,
            LC_MESSAGES,
        ];

        if (empty($languageCode) || !in_array($category, $availableCategories, true)) {
            return false;
        }

        $localeLongForm = self::getLongForm($languageCode, $countryCode);

        return setlocale($category, $localeLongForm);
    }
public static function setLocale ( $ category , $ languageCode , $ countryCode = '' ) { $ category = ( int ) $ category ; if ( is_string ( $ languageCode ) ) { $ languageCode = trim ( $ languageCode ) ; } $ availableCategories = [ LC_ALL , LC_COLLATE , LC_CTYPE , LC_MONETARY , LC_NUMERIC , LC_TIME , LC_MESSAGES , ] ; if ( empty ( $ languageCode ) || ! in_array ( $ category , $ availableCategories , true ) ) { return false ; } $ localeLongForm = self :: getLongForm ( $ languageCode , $ countryCode ) ; return setlocale ( $ category , $ localeLongForm ) ; }
Sets locale for given category using given language and country code

@param int    $category     Named constant specifying the category of the functions affected by the locale
setting. It's the same constant as required by setlocale() function.
@param string $languageCode Language code, in ISO 639-1 format. Short form of the locale, e.g. "fr".
@param string $countryCode  (optional) Country code, in ISO 3166-1 alpha-2 format, e.g. "FR"
@return false|string

Available categories (values of $category argument):
- LC_ALL for all of the below
- LC_COLLATE for string comparison, see strcoll()
- LC_CTYPE for character classification and conversion, for example strtoupper()
- LC_MONETARY for localeconv()
- LC_NUMERIC for decimal separator (See also localeconv())
- LC_TIME for date and time formatting with strftime()
- LC_MESSAGES for system responses (available if PHP was compiled with libintl)
Sets locale for given category using given language and country code