class Locale extends Locale

deprecated since version 2.3, to be removed in 3.0. Use {@link \Locale} and {@link \Symfony\Component\Intl\Intl} instead.

Helper class for dealing with locale strings.

Properties

static protected $countries Caches the countries in different locales.
static protected $languages Caches the languages in different locales.
static protected $locales Caches the different locales.

Methods

static array
getDisplayCountries(string $locale)

Returns the country names for a locale.

static array
getCountries()

Returns all available country codes.

static array
getDisplayLanguages(string $locale)

Returns the language names for a locale.

static array
getLanguages()

Returns all available language codes.

static array
getDisplayLocales(string $locale)

Returns the locale names for a locale.

static array
getLocales()

Returns all available locale codes.

static string|null
getIntlIcuVersion()

Returns the ICU version as defined by the intl extension.

static string|null
getIntlIcuDataVersion()

Returns the ICU Data version as defined by the intl extension.

static string
getIcuDataVersion()

Returns the ICU data version that ships with Symfony. If the environment variable USE_INTL_ICU_DATA_VERSION is defined, it will try use the ICU data version as defined by the intl extension, if available.

static string
getIcuDataDirectory()

Returns the directory path of the ICU data that ships with Symfony.

static string|null
getFallbackLocale(string $locale)

Returns the fallback locale for a given locale, if any.

Details

at line 52
static array getDisplayCountries(string $locale)

Returns the country names for a locale.

Parameters

string $locale The locale to use for the country names

Return Value

array The country names with their codes as keys

Exceptions

RuntimeException When the resource bundles cannot be loaded

at line 68
static array getCountries()

Returns all available country codes.

Return Value

array The country codes

Exceptions

RuntimeException When the resource bundles cannot be loaded

at line 82
static array getDisplayLanguages(string $locale)

Returns the language names for a locale.

Parameters

string $locale The locale to use for the language names

Return Value

array The language names with their codes as keys

Exceptions

RuntimeException When the resource bundles cannot be loaded

at line 98
static array getLanguages()

Returns all available language codes.

Return Value

array The language codes

Exceptions

RuntimeException When the resource bundles cannot be loaded

at line 112
static array getDisplayLocales(string $locale)

Returns the locale names for a locale.

Parameters

string $locale The locale to use for the locale names

Return Value

array The locale names with their codes as keys

Exceptions

RuntimeException When the resource bundles cannot be loaded

at line 128
static array getLocales()

Returns all available locale codes.

Return Value

array The locale codes

Exceptions

RuntimeException When the resource bundles cannot be loaded

at line 138
static string|null getIntlIcuVersion()

Returns the ICU version as defined by the intl extension.

Return Value

string|null The ICU version

at line 148
static string|null getIntlIcuDataVersion()

Returns the ICU Data version as defined by the intl extension.

Return Value

string|null The ICU Data version

at line 159
static string getIcuDataVersion()

Returns the ICU data version that ships with Symfony. If the environment variable USE_INTL_ICU_DATA_VERSION is defined, it will try use the ICU data version as defined by the intl extension, if available.

Return Value

string The ICU data version that ships with Symfony

at line 169
static string getIcuDataDirectory()

Returns the directory path of the ICU data that ships with Symfony.

Return Value

string The path to the ICU data directory

at line 181
static protected string|null getFallbackLocale(string $locale)

Returns the fallback locale for a given locale, if any.

Parameters

string $locale The locale to find the fallback for

Return Value

string|null The fallback locale, or null if no parent exists