I have translated urls in my multi language site. How do I link to an specific page in the front end in the current language?
the link is across site so I can’t use $page->url(). I tried page('registro')->url('es') using the id, ui, translated url. I get Call to a member function url() on null.
I did try page('register')->url('es'); with the translated url/slug for both languages. $page->url('es'); works has spected but I want to use the link in other templates so it would not do the work.
It seems it does not work because it’s a virtual page. <?= page('otherid')->url($kirby->languageCode()) ?> works with other pages but not with this one, which is a virtual one. Is this a bug?
Even with the same slug the page() helper doesn’t work. If you dump() the parent, you won’t see the virtual page listed has a child. So I guess it doesn’t work because they are virtual, but then how can we access it in a similar way to page()?