Locales
interface Locales
Locales data source
Methods
Get all country codes and names
Get all language codes and names
Get all locale codes and names
Get name of country by code
Get language name for this language or locale code
Get name of locale
Returns the country code / suffix on any locale
Provides you "likely locales" for a given "short" language code. This is a guess, as we can't disambiguate from e.g. "en" to "en_US" - it could also mean "en_UK". Based on the Unicode CLDR project.
Returns the "short" language name from a locale, e.g. "en_US" would return "en".
Validates a "long" locale format (e.g. "en_US") by checking it against {@link $locales}.
Returns the script direction in format compatible with the HTML "dir" attribute.
Details
at line 15
array
getCountries()
Get all country codes and names
at line 22
array
getLanguages()
Get all language codes and names
at line 29
array
getLocales()
Get all locale codes and names
at line 37
string
countryName(string $code)
Get name of country by code
at line 45
string
languageName(string $code)
Get language name for this language or locale code
at line 53
string
localeName(string $locale)
Get name of locale
at line 61
string
countryFromLocale(string $locale)
Returns the country code / suffix on any locale
at line 74
string
localeFromLang(string $lang)
Provides you "likely locales" for a given "short" language code. This is a guess, as we can't disambiguate from e.g. "en" to "en_US" - it could also mean "en_UK". Based on the Unicode CLDR project.
at line 83
string
langFromLocale(string $locale)
Returns the "short" language name from a locale, e.g. "en_US" would return "en".
at line 91
bool
validate(string $locale)
Validates a "long" locale format (e.g. "en_US") by checking it against {@link $locales}.
at line 100
string
scriptDirection(string $locale = null)
Returns the script direction in format compatible with the HTML "dir" attribute.