Language Manager getCurrentLanguage returns default language instead I am creating a multilingual D8 site, which 3 languages enabled.

In trying to display the currently active language, the snippet

$lang = \Drupal::languageManager()-&gt;getCurrentLanguage()-&gt;getName();


always returns the default language ( English ) even though the UI has switched to one of the alternative languages. The above line is called from the mytheme.theme file in hook_preprocess_page.

In the language switcher block, the correct language is getting the session-active is-active classes.

When referencing the documentation for D8.5 in the above method, in the code shown it very much shows like this is what the function does:

public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE) 
{
  return $this
    -&gt;getDefaultLanguage();
}


Am I missing something obvious here? Is there another way to get the current active language?
The method you've quoted is the default code for single language sites. For multilingual sites the default LanguageManager is replaced with ConfigurableLanguageManager and the method is overridden wtih this content:

ConfigurableLanguageManager::getCurrentLanguage:

public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE) {
  if (!isset($this-&gt;negotiatedLanguages[$type])) {

    // Ensure we have a valid value for this language type.
    $this-&gt;negotiatedLanguages[$type] = $this
      -&gt;getDefaultLanguage();
    if ($this-&gt;negotiator &amp;&amp; $this
      -&gt;isMultilingual()) {
      if (!$this-&gt;initializing) {
        $this-&gt;initializing = TRUE;
        $negotiation = $this-&gt;negotiator
          -&gt;initializeType($type);
        $this-&gt;negotiatedLanguages[$type] = reset($negotiation);
        $this-&gt;negotiatedMethods[$type] = key($negotiation);
        $this-&gt;initializing = FALSE;
      }
      elseif ($type == LanguageInterface::TYPE_INTERFACE) {
        return new Language([
          'id' =&gt; LanguageInterface::LANGCODE_SYSTEM,
        ]);
      }
    }
  }
  return $this-&gt;negotiatedLanguages[$type];
}


Then the result depends on the language negotiators you have configured in language detection, see comment from @Clive.