Locale implements Stringable

A representation of language key (based on ISO 639-1 / ISO 639-2) - the optional four-letter script code that can follow the language code according to the Unicode ISO 15924 Registry (e.g. Hans in zh_Hans) - region / country (based on ISO 3166-1) separated with a "-".

This conforms to IETF - RFC 5646 (see https://datatracker.ietf.org/doc/rfc5646/) in a simplified form.

Table of Contents

Interfaces

Stringable

Constants

RIGHT_TO_LEFT_LANGUAGE_CODES  = [ 'ar', // Arabic 'arc', // Aramaic 'arz', // Egyptian Arabic 'ckb', // Kurdish (Sorani) 'dv', // Divehi 'fa', // Persian 'ha', // Hausa 'he', // Hebrew 'khw', // Khowar 'ks', // Kashmiri 'ps', // Pashto 'sd', // Sindhi 'ur', // Urdu 'uz-AF', // Uzbeki Afghanistan 'yi', ]

Properties

$charsetModifier  : string|null
$codeSet  : string|null
$countryCode  : string|null
$dependencies  : array<int, string>
List of language dependencies for an actual language. This setting is used for local variants of a language that depend on their "main" language, like Brazilian Portuguese or Canadian French.
$languageCode  : string
$languageScript  : string|null
$locale  : string

Methods

__construct()  : mixed
__toString()  : string
getCountryCode()  : string|null
getDependencies()  : array<string|int, mixed>
getLanguageCode()  : string
getLanguageScriptCode()  : string|null
getName()  : string
getPosixCodeSet()  : string|null
isRightToLeftLanguageDirection()  : bool
posixFormatted()  : string
Return the locale as ISO/IEC 15897 format, including a possible POSIX charset "cs_CZ.UTF-8" see https://en.wikipedia.org/wiki/ISO/IEC_15897 https://en.wikipedia.org/wiki/Locale_(computer_software)#POSIX_platforms
normalize()  : string

Constants

RIGHT_TO_LEFT_LANGUAGE_CODES

protected mixed RIGHT_TO_LEFT_LANGUAGE_CODES = [ 'ar', // Arabic 'arc', // Aramaic 'arz', // Egyptian Arabic 'ckb', // Kurdish (Sorani) 'dv', // Divehi 'fa', // Persian 'ha', // Hausa 'he', // Hebrew 'khw', // Khowar 'ks', // Kashmiri 'ps', // Pashto 'sd', // Sindhi 'ur', // Urdu 'uz-AF', // Uzbeki Afghanistan 'yi', ]

Properties

$charsetModifier

protected string|null $charsetModifier = null

$codeSet

protected string|null $codeSet = null

$countryCode

protected string|null $countryCode = null

$dependencies

List of language dependencies for an actual language. This setting is used for local variants of a language that depend on their "main" language, like Brazilian Portuguese or Canadian French.

protected array<int, string> $dependencies = []

$languageCode

protected string $languageCode

$languageScript

protected string|null $languageScript = null

Methods

__construct()

public __construct([string $locale = 'en' ][, array<string|int, mixed> $dependencies = [] ]) : mixed
Parameters
$locale : string = 'en'
$dependencies : array<string|int, mixed> = []

__toString()

public __toString() : string
Return values
string

getCountryCode()

public getCountryCode() : string|null
Return values
string|null

getDependencies()

public getDependencies() : array<string|int, mixed>
Return values
array<string|int, mixed>

getLanguageCode()

public getLanguageCode() : string
Return values
string

getLanguageScriptCode()

public getLanguageScriptCode() : string|null
Return values
string|null

getName()

public getName() : string
Return values
string

getPosixCodeSet()

public getPosixCodeSet() : string|null
Internal
Return values
string|null

isRightToLeftLanguageDirection()

public isRightToLeftLanguageDirection() : bool
Return values
bool

posixFormatted()

Return the locale as ISO/IEC 15897 format, including a possible POSIX charset "cs_CZ.UTF-8" see https://en.wikipedia.org/wiki/ISO/IEC_15897 https://en.wikipedia.org/wiki/Locale_(computer_software)#POSIX_platforms

public posixFormatted() : string
Internal
Return values
string

normalize()

protected normalize(string $locale) : string
Parameters
$locale : string
Return values
string

        
On this page

Search results