Skip to content

Kirby 4.4.1

$languages

The $languages object gives you a collection of all the languages that have been defined for your Kirby installation. The methods of this class allow you to filter, find, group, search the languages collection.

Details

To use the methods of the $languages class, you need a $languages object, which you get can like this:

$languages = $kirby->languages();

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

Examples

Find a language by code

$language = $languages->find('de');

Get the number of languages

$numberOfLanguage = $languages->count();

Sort languages by name

$sortedLanguages = $languages->sortBy('name', 'desc');