Skip to end of metadata
Go to start of metadata

$L = LBSystem::readlanguage($langfile);

See also PHP functions to create your webpage with LoxBerry design

Returns the appropriate user language as an array.


Reads the language from language specific language files.

Your plugin filesystem should look like:

  • template/lang/language_de.ini
  • template/lang/language_en.ini

 For this files, your $langfile parameter needs to be:

  • language.ini

Your language files are searched in template/lang/.

The function appends the user language before of the dot in language.ini (language_en, langauge_de, language_cz and so on).

It reads both the users language and the English (fallback) language. If any phrase is missing in the user language, the English phase is taken.


The function returns an $array with keys. The key is assembled from the section and the tag of the language file in the form:


You can access every phrase using $L['SECTION.TAG'].


$L = LBSystem::readlanguage("language.ini");
# Access language phrase inside script
echo "$L['SECTION.PHRASE']";

Your language file for this example should look like this:

PHRASE=This is the text that is printed.

The language files need to be encoded in UTF-8 without BOM. Line endings need to be Unix LF.

Special features for LoxBerry-Core developers

You won't need this as a plugin developer.

This will read the system language to $SL (access by $SL['COMMON.LOXBERRY_MAIN_TITLE'])

$SL = LBSystem::readlanguage(null, null, true);

function readlanguage($template = NULL, $genericlangfile = "language.ini", $syslang = FALSE)

$template is a LBTemplate object - the language is directly sent to this template.

$syslang = True reads the LBSTEMPLATEDIR/lang/language.ini. The $genericlangfile parameter is ignored in that case. The parameter is used in head and pagestart as also for plugins we need to force the system language for the LB templates.

  • No labels