$field->isTranslated($lang = null)

Checks if the field is translated in the current/specified language

A field value is considered as translated if it is not empty and is not equal to the field value of the default language. $field->isTranslated() will always return true for the default language as well as for single language setups.


<?php if($page->description()->isTranslated()): ?>
  <?= $page->description()->kirbytext() ?>
<?php endif ?>

Check for a specific language

By passing a language code as the $lang parameter, you can check for a translation in that language:

<?php if($page->description()->isTranslated('de')): ?>
  // Field 'description' is translated in German
<?php endif ?>

Is something missing or incorrect? Edit this page on Github…