class Language (View source)

Language object

Properties

protected string $regex

Methods

__construct(string $code, string $name, string $native, string $regex, string $mysql)

Constructs the Language object

string
getNativeName()

Returns native name for language

string
getEnglishName()

Returns English name for language

string
getName()

Returns verbose name for language

string
getCode()

Returns language code

string
getMySQLLocale()

Returns MySQL locale code, can be empty

int
cmp(Language $other)

Compare function used for sorting

bool
isActive()

Checks whether language is currently active.

bool
matchesAcceptLanguage(string $header)

Checks whether language matches HTTP header Accept-Language.

bool
matchesUserAgent(string $header)

Checks whether language matches HTTP header User-Agent

bool
isRTL()

Checks whether language is RTL

void
activate()

Activates given translation

Details

__construct(string $code, string $name, string $native, string $regex, string $mysql)

Constructs the Language object

Parameters

string $code

Language code

string $name

English name

string $native

Native name

string $regex

Match regular expression

string $mysql

MySQL locale code

string getNativeName()

Returns native name for language

Return Value

string

string getEnglishName()

Returns English name for language

Return Value

string

string getName()

Returns verbose name for language

Return Value

string

string getCode()

Returns language code

Return Value

string

string getMySQLLocale()

Returns MySQL locale code, can be empty

Return Value

string

int cmp(Language $other)

Compare function used for sorting

Parameters

Language $other

Other object to compare

Return Value

int

same as strcmp

bool isActive()

Checks whether language is currently active.

Return Value

bool

bool matchesAcceptLanguage(string $header)

Checks whether language matches HTTP header Accept-Language.

Parameters

string $header

Header content

Return Value

bool

bool matchesUserAgent(string $header)

Checks whether language matches HTTP header User-Agent

Parameters

string $header

Header content

Return Value

bool

bool isRTL()

Checks whether language is RTL

Return Value

bool

void activate()

Activates given translation

Return Value

void