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.

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

When I run

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

I’m getting the URL of the selected project, but always in the default language.

What would be the way to get the url based on the current selected language, so it becomes:

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:

Fantastic, works perfectly. Thank you!