Getting the URL for every language I have a route of a page, and I want get the link for it on every language of my site.

On my site the contact page is: en/contact for English, and es/contactenos for Spanish.

I am trying using the following code, but I am getting just the URL for the current language set for the site.

$route = 'contact.site_page';
$url = new Url($route);
$uri = $url-&gt;toString();


How do I get it for every language available for the site?
I found the solution myself, with the following code.

// Get all languages of the site
$languages = \Drupal::languageManager()-&gt;getLanguages();

// Route of contact for example:
$route = 'contact.site_page';
foreach ($languages as $language) {
  $url = new Url($route, [], ['language' =&gt; $language]);
  $uri = $url-&gt;toString();
}