Redirect to the front page with a different language i have a question about redirecting to a page with a different language. I found this old post for drupal 7 but I doesn't really help me - https://www.drupal.org/node/1280468

Now we are in Drupal 8 and the redirect works like this:

return new RedirectResponse(\Drupal::url('&lt;front&gt;'))


But how can I set the language for the redirect? In my code I have the languagecode like NZ for New Zealand.
You can try this code 

 &lt;?php

 use Drupal\Core\Url;
 use Symfony\Component\HttpFoundation\RedirectResponse;

 $language = Drupal::languageManager()-&gt;getLanguage('vi');
 $url = Url::fromRoute('&lt;front&gt;', [], ['language' =&gt; $language]);
 $response = new RedirectResponse($url-&gt;toString());
 $response-&gt;send();