Locale::getScript
locale_get_script
(PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
Locale::getScript -- locale_get_script — Gets the script for the input locale
Description
Object oriented style
public
static
string
Locale::getScript
( string
$locale
)Procedural style
string
locale_get_script
( string
$locale
)Gets the script for the input locale.
Parameters
-
locale
-
The locale to extract the script code from
Return Values
The script subtag for the locale or NULL
if not present
Examples
Example #1 locale_get_script() example
<?php
echo locale_get_script('sr-Cyrl');
?>
Example #2 OO example
<?php
echo Locale::getScript('sr-Cyrl');
?>
The above example will output:
Cyrl
See Also
- locale_get_primary_language() - Gets the primary language for the input locale
- locale_get_region() - Gets the region for the input locale
- locale_get_all_variants() - Gets the variants for the input locale
- 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_script does no validation of whether the script exists, but just extracts the 4-character text that looks like it can be the script part of the locale, and formats it with an initial cap.