Utilities - Locale - getLocale() method - returns locale for given category

This commit is contained in:
Meritoo
2018-01-27 13:05:20 +01:00
parent af38c35a1b
commit 470b8244ec
2 changed files with 36 additions and 0 deletions

View File

@@ -61,6 +61,27 @@ class Locale
return setlocale($category, $localeLongForm);
}
/**
* Returns locale for given category
*
* @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.
* @return 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)
*/
public static function getLocale($category)
{
return setlocale($category, '0');
}
/**
* Returns long form of the locale
*