Select Field fetch page, language

Hey there.
I’m working on a multi language install and have a question about the select field.
Currently running this code, to relate a page to a specific project.

  project:
    label: Select Project
    type: select
    options: query
    query:
      fetch: pages
      template: project
      value: '{{url}}'
    required: true

When I run

<?php foreach($page->children()->flip()->visible() as $item): ?>
<div>
    <?= $item->project()->html() ?>
</div>
<?php endforeach ?>

I’m getting the URL of the selected project, but always in the default language.
mydomain.com/projects/project-title/

What would be the way to get the url based on the current selected language, so it becomes:
mydomain.com/de/projects/project-title/
mydomain.com/fr/projects/project-title/

Thanks in advance

If you store the URI, you shouldn’t run into this. problem.

if($p = $item->project()->toPage()) {
  echo $p->url();
}

That should automatically fetch the right language. If not, you can provide the language code as a parameter in your url method: https://getkirby.com/docs/cheatsheet/page/url

Fantastic, works perfectly. Thank you!