Generating url on other sites [multisite]

I am using 2 site definitions, french and english.

some data are accessible across the 2 sites.

sometimes, i need to generate an url from one site (english) toward the other site (french)

I look into the page twig filter but didnt find anything here.
I am guessing i’d need to generate the url in php using the pagename and attributes, but how to handle the choice of the site here ?

The sitePicker should be able to generate links to other sites. If you provide an example, perhaps we can show you the way…

thanks @daft,
I managed to find a solution to that requirement, i cant remember how though haha

I actually didnt find a proper solution.

my use case is the following.
The website offer two locales, english and thai.

on the user account, therefore after login, a page will display the courses he is enrolled in.

These courses can be coming from the site English or the Thai one.

the account page is using the scope ->withoutGlobalScopes() to retrieve all the courses he is enrolled in whatever the side he is currently on.

then I set the url for each course, like in the component blogPosts from the RainLab.Blog plugin with the following code

$courses->each(function ($course) {
       $course->setUrl($this->previewPage, $this->controller, []);
 });

and obviously, the url generated should be related to the course related site and not the current site.

Does it make sense ?

thanks for any help

I have found this solution in case of anyone needs it as well some day:

$page = Page::loadCached($this->getTheme(), $this->previewPage);
$course->url = Cms::siteUrl($page, $site, ['course' => $course->slug]);