Locale::getRegion
locale_get_region
(No version information available, might be only in CVS)
locale_get_region — Gets the region for the input locale
Описание
Object oriented style
static
string
Locale::getRegion
( string $locale
)
Procedural style
string
locale_get_region
( string $locale
)
Gets the region for the input locale.
Список параметров
- locale
-
The locale to extract the region code from
Возвращаемые значения
The region subtag for the locale or NULL if not present
Примеры
Пример #1 locale_get_region() example
<?php
echo locale_get_region('de-CH-1901');
?>
Пример #2 OO example
<?php
echo Locale::getRegion('de-CH-1901');
?>
Результат выполнения данного примера:
CH
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Поддержка языков и кодировок
- Internationalization Functions
- Функция Locale::acceptFromHttp() - Tries to find out best available locale based on HTTP "Accept-Language" header
- Функция Locale::canonicalize() - Canonicalize the locale string
- Функция Locale::composeLocale() - Returns a correctly ordered and delimited locale ID
- Функция Locale::filterMatches() - Checks if a language tag filter matches with locale
- Функция Locale::getAllVariants() - Gets the variants for the input locale
- Функция Locale::getDefault() - Gets the default locale value from the INTL global 'default_locale'
- Функция Locale::getDisplayLanguage() - Returns an appropriately localized display name for language of the inputlocale
- Функция Locale::getDisplayName() - Returns an appropriately localized display name for the input locale
- Функция Locale::getDisplayRegion() - Returns an appropriately localized display name for region of the input locale
- Функция Locale::getDisplayScript() - Returns an appropriately localized display name for script of the input locale
- Функция Locale::getDisplayVariant() - Returns an appropriately localized display name for variants of the input locale
- Функция Locale::getKeywords() - Gets the keywords for the input locale
- Функция Locale::getPrimaryLanguage() - Gets the primary language for the input locale
- Функция Locale::getRegion() - Gets the region for the input locale
- Функция Locale::getScript() - Gets the script for the input locale
- Функция Locale::lookup() - Searches the language tag list for the best match to the language
- Функция Locale::parseLocale() - Returns a key-value array of locale ID subtag elements.
- Функция Locale::setDefault() - sets the default runtime locale
Коментарии
locale_get_region does no validation of whether the region exists, but just extracts the text that looks like it can be the region part of the locale, and formats it as uppercase.
It doesn't even have to be a 2-character code, but can be an invalid 3-character one.