- 415 views
Use HOOK_preprocess_html()
It is easy as that, just open you .theme file in your theme and add the code below.
/** * Implements hook_preprocess_HOOK() for HTML document templates. */ function YOURTHEME_preprocess_html(&$variables) { $variables['attributes']['class'][] = 'language_' . \Drupal::languageManager()->getCurrentLanguage()->getId(); }
Clear the cache
Now just clear the cache and new language class should appear in your body classes array. It should be something like language_XX