class LanguageManager

Language selection manager

Methods

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

availableLanguages()

Returns (cached) list of all available languages

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.

string
getSelectorDisplay(Template $template, bool $use_fieldset = false, bool $show_doc = true)

Returns HTML code for the language selector

Details

at line 688
static LanguageManager getInstance()

Returns LanguageManager singleton

Return Value

LanguageManager

at line 701
array listLocaleDir()

Returns list of available locales

Return Value

array

at line 740
array availableLocales()

Returns (cached) list of all available locales

Return Value

array of strings

at line 760
bool hasChoice()

Checks whether there are some languages available

Return Value

bool

at line 770
Language[] availableLanguages()

Returns (cached) list of all available languages

Return Value

Language[] array of Language objects

at line 806
Language[] sortedLanguages()

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

Return Value

Language[] array of Language objects

at line 822
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

at line 837
Language getCurrentLanguage()

Return currently active Language object

Return Value

Language Language object

at line 848
Language selectLanguage()

Activates language based on configuration, user preferences or browser

Return Value

Language

at line 926
void showWarnings()

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

Return Value

void

at line 951
string getSelectorDisplay(Template $template, bool $use_fieldset = false, bool $show_doc = true)

Returns HTML code for the language selector

Parameters

Template $template Template instance
bool $use_fieldset whether to use fieldset for selection
bool $show_doc whether to show documentation links

Return Value

string