Getting text for specific language

I have a site in 4 languages. I show the description of items for the customer:
$item->omschrijving()->html() (omschrijving = description)

But for internal use I want to get the description only in Dutch (‘nl’).
I saw something like ->content(‘nl’) but did not succeed to get that language content.

Yes,

<?= $page->content('nl')->get('fieldname') ?>

Or

<?= $page->content('nl')->fieldname() ?>

Will do the job.

1 Like

Thanks. That did point me in a direction:

		<?php $prijzen_nl = $site->content('nl')->prijzen()->yaml() ?>
		<?php foreach ($site->prijzen()->toStructure() as $item): ?>
			<?php $oms_nl = $prijzen_nl[$i]['omschrijving']; ?>

I firstly tried to do something with $item. Now I used a second array for the Dutch descriptions.
It works, but maybe this is not the best solution?

You are overcomplicating your code:

<?php foreach ($site->content('nl')->prijzen()->toStructure() as $item): ?>
  <?= $item->omschrijving() ?>
<?php endforeach ?>

Maybe I was not clear enough. At the frontend of the the site I am using the description in the desired language, But for sending the description to the backend (that is only in Dutch) I want to send the Dutch description. So am I using 2 fields: One with the Dutch description and One that depends on the choosen language. Only in the Dutch language it will be the same.