I feel like there’s something obvious I’m missing here, but I can’t find it anywhere in the Kirby Docs. In a multilingual site, I need to get the value of a field in a specific language - which may not be the current one. Is that what the translation() method is for?:
<?= $page->translation('de')->myfield() ?>
Whatever method we use, if there field does not have a translated value in that language, will it automatically fallback to the default language value?
translation() gets the [translation](https://getkirby.com/docs/reference/@/classes/cms/contenttranslation) object that you can use to check if a content file in a given language exists.
If the content is not available in the requested language, does it return whatever is available in the ‘default’ language, or does it return empty/null/error?
If the language is defined and the translation doesn’t exist, the default language content is returned. If you pass the language code of a language that is not defined, an error is thrown.
It’s not deprecated, can still be used. What was deprecated is the content() method of the Panel support Classe (e.g. Kirby\Panel\Page), but not Kirby\Cms\Page which is what we usually talk about when referring to $page, $file etc.
And is there also a way to get the content in a website’s primary language (without hardcoding the language code into the request)?
Also, how about structure fields? If I have a field in a specific row of a structure fields, how would I go about fetching that same field in another language (f.e. the primary language)?