How to access current langcode in theme? I use Integrity theme and want to make the slider images i18n aware.

I want to get the current langcode in the 

function _integrity_get_home_block_contents


Previously it worked like this:

   global $language;
   $lang_id = $language-&gt;language;


What do I do now?
Here's how to do the same in Drupal 8:

$language = \Drupal::languageManager()-&gt;getCurrentLanguage();
// Will return "en".
$shortcode = $language-&gt;getId());
// Will return "English".
$language_name = $language-&gt;getName();


Read more here.