Документация PHP


NumberFormatter::setTextAttribute

Locale::composeLocale

intl

PHP Manual


The Locale class

Введение

A "Locale" is an identifier used to get language, culture, or regionally-specific behavior from an API. PHP locales are organized and identified the same way that the CLDR locales used by ICU (and many vendors of Unix-like operating systems, the Mac, Java, and so forth) use. Locales are identified using RFC 4646 language tags (which use hyphen, not underscore) in addition to the more traditional underscore-using identifiers. Unless otherwise noted the functions in this class are tolerant of both formats.

Examples of identifiers include:

  • en-US (English, United States)
  • zh-Hant-TW (Chinese, Traditional Script, Taiwan)
  • fr-CA, fr-FR (French for Canada and France respectively)

The Locale class (and related procedural functions) are used to interact with locale identifiers--to verify that an ID is well-formed, valid, etc. The extensions used by CLDR in UAX #35 (and inherited by ICU) are valid and used wherever they would be in ICU normally.

Locales cannot be instantiated as objects. All of the functions/methods provided are static.

The null or empty string obtains the "root" locale. The "root" locale is equivalent to "en_US_POSIX" in CLDR. Language tags (and thus locale identifiers) are case insensitive. There exists a canonicalization function to make case match the specification.

Class synopsis

Locale

class Locale {

/* Methods */

static string composeLocale ( array $subtags )

static boolean filterMatches ( string $langtag , string $locale )

static array getAllVariants ( string $locale )

static string getDefault ( void )

static string getDisplayLanguage ( string $locale [, string $in_locale ] )

static string getDisplayName ( string $locale [, string $in_locale ] )

static string getDisplayRegion ( string $locale [, string $in_locale ] )

static string getDisplayScript ( string $locale [, string $in_locale ] )

static string getDisplayVariant ( string $locale [, string $in_locale ] )

static array getKeywords ( string $locale )

static string getPrimaryLanguage ( string $locale )

static string getRegion ( string $locale )

static string getScript ( string $locale )

static string lookup ( array $langtag , string $locale , string $default )

static array parseLocale ( string $locale )

static boolean setDefault ( string $locale )

}

Предопределенные константы

These constants define how the Locale

Locale::DEFAULT_LOCALE (string)
Used with the getLocale methods of the various locale affected classes, such as numfmt.
Locale::ACTUAL_LOCALE (string)
This is locale the data actually comes from.
Locale::VALID_LOCALE (string)
This is the most specific locale supported by ICU.

These constants define how the Locales are parsed or composed. They should be used as keys in the argument array to locale_compose() and are returned from locale_parse() as keys of the returned associative array.

Locale::LANG_TAG (string)
Language subtag
Locale::EXTLANG_TAG (string)
Extended language subtag
Locale::SCRIPT_TAG (string)
Script subtag
Locale::REGION_TAG (string)
Region subtag
Locale::VARIANT_TAG (string)
Variant subtag
Locale::GRANDFATHERED_LANG_TAG (string)
Grandfathered Language subtag
Locale::PRIVATE_TAG (string)
Private subtag

Смотрите также

Содержание


NumberFormatter::setTextAttribute

Locale::composeLocale

intl

PHP Manual

SAPE все усложнил?

MainLink - простая и прибыльная продажа ссылок!

Последние поступления:

ТехЗадание на Землю

Размещена 14 марта 2018 года

Пpоект Genesis (из коpпоpативной пеpеписки)

читать далее…

Шпаргалка по работе с Vim

Размещена 05 декабря 2017 года

Vim довольно мощный редактор, но работа с ним не всегда наглядна.
Например если нужно отредактировать какой-то файл например при помощи crontab, без знания специфики работы с viv никак.

читать далее…

Ошибка: Error: Cannot find a valid baseurl for repo

Размещена 13 сентабря 2017 года

Если возникает ошибка на centos 5 вида
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/

читать далее…

Linux Optimization

Размещена 30 июля 2012 года

Prelink

читать далее…

Размещена 06 апреля 2012 года

С детства мечтаю увидеть трёх животных: ёшкиного кота, бляху муху и сидорую козу!!!