Drupal 8 - Check if language prefix is present in url or not
There might be something more elegant, but doing it the dirty way is pretty simple:

$languagecode = \Drupal::languageManager()-&gt;getCurrentLanguage()-&gt;getId();
$parts = array_filter(explode('/', \Drupal::request()-&gt;getRequestUri()));

$has_prefix = count($parts) &amp;&amp; $parts[0] == $languagecode;