Documentation

Languages extends ResourceBundle
in package

FinalYes

Gives access to language-related ICU data.

Tags
author

Bernhard Schussek bschussek@gmail.com

author

Roland Franssen franssen.roland@gmail.com

Table of Contents

Methods

alpha3CodeExists()  : bool
exists()  : bool
getAlpha2Code()  : string
Returns the ISO 639-1 two-letter code of a language, given a three letter code.
getAlpha3Code()  : string
Returns the ISO 639-2 three-letter code of a language, given a two-letter code.
getAlpha3Codes()  : array<string|int, string>
Returns all available languages as three-letter codes.
getAlpha3Name()  : string
Gets the language name from its ISO 639-2 three-letter code.
getAlpha3Names()  : array<string, string>
Gets the list of language names indexed with ISO 639-2 three-letter codes as keys.
getLanguageCodes()  : array<string|int, string>
Returns all available languages as two-letter codes.
getName()  : string
Gets the language name from its alpha2 code.
getNames()  : array<string, string>
Gets the list of language names indexed with alpha2 codes as keys.
getPath()  : string

Methods

alpha3CodeExists()

public static alpha3CodeExists(string $language) : bool
Parameters
$language : string

ISO 639-2 three-letter language code

Return values
bool

exists()

public static exists(string $language) : bool
Parameters
$language : string
Return values
bool

getAlpha2Code()

Returns the ISO 639-1 two-letter code of a language, given a three letter code.

public static getAlpha2Code(string $language) : string
Parameters
$language : string
Tags
throws
MissingResourceException

if the language has no corresponding three-letter code

Return values
string

getAlpha3Code()

Returns the ISO 639-2 three-letter code of a language, given a two-letter code.

public static getAlpha3Code(string $language) : string
Parameters
$language : string
Tags
throws
MissingResourceException

if the language has no corresponding three-letter code

Return values
string

getAlpha3Codes()

Returns all available languages as three-letter codes.

public static getAlpha3Codes() : array<string|int, string>

Languages are returned as lowercase ISO 639-2 three-letter language codes.

Return values
array<string|int, string>

an array of canonical ISO 639-2 language codes

getAlpha3Name()

Gets the language name from its ISO 639-2 three-letter code.

public static getAlpha3Name(string $language[, string $displayLocale = null ]) : string
Parameters
$language : string
$displayLocale : string = null
Tags
throws
MissingResourceException

if the country code does not exists

Return values
string

getAlpha3Names()

Gets the list of language names indexed with ISO 639-2 three-letter codes as keys.

public static getAlpha3Names([string $displayLocale = null ]) : array<string, string>

Same as method getNames, but with ISO 639-2 three-letter codes instead of ISO 639-1 codes as keys.

Parameters
$displayLocale : string = null
Return values
array<string, string>

getLanguageCodes()

Returns all available languages as two-letter codes.

public static getLanguageCodes() : array<string|int, string>

Languages are returned as lowercase ISO 639-1 two-letter language codes. For languages that don't have a two-letter code, the ISO 639-2 three-letter code is used instead.

A full table of ISO 639 language codes can be found here: http://www-01.sil.org/iso639-3/codes.asp

Return values
array<string|int, string>

an array of canonical ISO 639-1 language codes

getName()

Gets the language name from its alpha2 code.

public static getName(string $language[, string $displayLocale = null ]) : string

A full locale may be passed to obtain a more localized language name, e.g. "American English" for "en_US".

Parameters
$language : string
$displayLocale : string = null
Tags
throws
MissingResourceException

if the language code does not exist

Return values
string

getNames()

Gets the list of language names indexed with alpha2 codes as keys.

public static getNames([string $displayLocale = null ]) : array<string, string>
Parameters
$displayLocale : string = null
Return values
array<string, string>

getPath()

protected static getPath() : string
Return values
string

        
On this page

Search results