This is what I learned from user FabianSperrle:
foreach ($page->children()->filterBy('languages', $site->language()->code(), ',') as $child) {
Source: Filter child pages by available translations
Where do I find out what can be filtered by filterBy function? The example above is not mentioned in the docs.
Is this a working example? Sadly, it does not work for me when applying the filterBy function to foreach function.
I also tried to filter after index()
$results = $site->index()->filterBy('languages', $site->language()->code(), ',')->visible()->search($query, 'title|text');
but did not succeed.
EDIT: I now understand that this example of FabianSerrle only works when adding custom fields to the text files.
Is there any other way to filter by language? This should be a basic function of a CMS, I guess.