class LanguageManager (View source)

Language selection manager

Properties

static LanguageManager|null $instance
static TextDirection $textDirection

Methods

__construct(Config $config)

No description

static LanguageManager
getInstance()

Returns LanguageManager singleton

array
listLocaleDir()

Returns list of available locales

array
availableLocales()

Returns (cached) list of all available locales

bool
hasChoice()

Checks whether there are some languages available

array
availableLanguages()

Returns (cached) list of all available languages

array
sortedLanguages()

Returns (cached) list of all available languages sorted by name

Language|false
getLanguage(string $code)

Return Language object for given code

getCurrentLanguage()

Return currently active Language object

selectLanguage()

Activates language based on configuration, user preferences or browser

void
showWarnings()

Displays warnings about invalid languages. This needs to be postponed to show messages at time when language is initialized.

void
activate(Language $language)

Activates given translation

Details

__construct(Config $config)

No description

Parameters

Config $config

static LanguageManager getInstance()

Returns LanguageManager singleton

Return Value

LanguageManager

array listLocaleDir()

Returns list of available locales

Return Value

array

array availableLocales()

Returns (cached) list of all available locales

Return Value

array

bool hasChoice()

Checks whether there are some languages available

Return Value

bool

array availableLanguages()

Returns (cached) list of all available languages

Return Value

array

array sortedLanguages()

Returns (cached) list of all available languages sorted by name

Return Value

array

array of Language objects

Language|false getLanguage(string $code)

Return Language object for given code

Parameters

string $code

Language code

Return Value

Language|false

Language object or false on failure

Language getCurrentLanguage()

Return currently active Language object

Return Value

Language

Language object

Language selectLanguage()

Activates language based on configuration, user preferences or browser

Return Value

Language

void showWarnings()

Displays warnings about invalid languages. This needs to be postponed to show messages at time when language is initialized.

Return Value

void

Exceptions

UnsupportedLanguageCode

void activate(Language $language)

Activates given translation

Parameters

Language $language

Return Value

void

Exceptions

UnsupportedLanguageCode