Skip to content

Kirby 4.5.0

$language

The $language object represents a single language in a multi-language Kirby setup. You can, for example, use the methods of this class to get the name or locale of a language, check for the default language, get translation strings and many more things.

Details

To have access to the methods of the $language object, you need to get a language object first:

Default language

$language = $kirby->defaultLanguage();

The current language

$language = $kirby->language();

Any particular language

$language = $kirby->language('fr');

Examples

With the object in place, you can use it like this:

Get the language code

echo $language->code();

Get the language name

echo $language->name();

Get the available translations

dump($language->translations());