I found out i can pass parameters with the url() method like so:
$page->url(["params" => ["test" => "cool"]]);
This function is very useful (and not documented as far as i can see) but how can i get and url with params and a different language ? I tried the following without success:
$page->url("it", ["params" => ["test" => "cool"]]);
$page->url(["params" => ["test" => "cool"]], "it");
$page->url(["params" => ["test" => "cool"], "language" => "it"]);
$page->url(["params" => ["test" => "cool"], "lang" => "it"]);
$page->url(["params" => ["test" => "cool"], "locale" => "it"]);