Application
Table of Contents
Functions
- cms_set_frontend_language() : mixed
- Temporarily override the current frontend language.
- lang_by_realm() : string
- Retrieve a translation for a specific string in a specific realm.
- lang() : string
- Return a translated string for the default 'admin' realm.
- get_encoding() : string
- Get the encoding of the current language.
- get_language_list() : associative
- Retrieve a list of installed languages that is suitable for use in a dropdown.
Functions
cms_set_frontend_language()
Temporarily override the current frontend language.
cms_set_frontend_language([string $lang = '' ]) : mixed
Parameters
- $lang : string = ''
-
The language to set. If empty, the system will be restored to the default frontend language.
Tags
lang_by_realm()
Retrieve a translation for a specific string in a specific realm.
lang_by_realm(string $realm, string $key) : string
Called with the realm first, followed by the key, this method will attempt to load the specific realm data if necessary before doing translation.
This method accepts a variable number of arguments. Any arguments after the realm and the key are passed to the key via vsprintf
i.e: lang_by_realm('tasks','my_string');
Parameters
- $realm : string
-
The realm
- $key : string
-
The lang key and any vspring arguments.
Tags
Return values
stringlang()
Return a translated string for the default 'admin' realm.
lang(string $key) : string
This function is merely a wrapper around the lang_by_realm function that assumes the realm is 'admin'.
This method will throw a notice if it is called from a frontend request
i.e: lang('title');
Parameters
- $key : string
-
The key to translate and then any vsprintf arguments for the key.
Tags
Return values
stringget_encoding()
Get the encoding of the current language.
get_encoding() : string
Tags
Return values
stringget_language_list()
Retrieve a list of installed languages that is suitable for use in a dropdown.
get_language_list([bool $allow_none = true ]) : associative
Parameters
- $allow_none : bool = true
-
Optionally adds 'none' (translated to current language) to the top of the list.
Return values
associative —array of lang keys and display strings.