How to get language prefix in Drupal 8
In Drupal 8, you use the languageManager class to get the language code:

$languagecode = \Drupal::languageManager()-&gt;getCurrentLanguage()-&gt;getId();


EDIT: If you want to return NONE if the current language is the default language, you probably need to make a helper function:

$languagecode = \Drupal::languageManager()-&gt;getCurrentLanguage()-&gt;getId();
$default_languagecode = \Drupal::languageManager()-&gt;getDefaultLanguage()-&gt;getId();
if ($languagecode == $default_languagecode) {
  return "NONE";
}
else {
  return $languagecode;
}


helper function to ge it from settings

function getLanguagePrefix() {
    if($prefixes = \Drupal::config('language.negotiation')-&gt;get('url.prefixes')) {
      $language = \Drupal::languageManager()-&gt;getCurrentLanguage()-&gt;getId();
      return "/". $prefixes[$language];
    }
    return null;
  }