--- /dev/null
+/**
+ * Implements hook_language_switch_links_alter().
+ */
+function {{ machine_name }}_language_switch_links_alter(array &$links, $type, \Drupal\Core\Url $url) {
+ $language_interface = \Drupal::languageManager()->getCurrentLanguage();
+
+ if ($type == LanguageInterface::TYPE_CONTENT && isset($links[$language_interface->getId()])) {
+ foreach ($links[$language_interface->getId()] as $link) {
+ $link['attributes']['class'][] = 'active-language';
+ }
+ }
+}