old_contents: # -*- coding: utf-8 -*-
  from django.conf import settings
  from django.utils.translation import get_language
  
  from haystack import routers
  from haystack.constants import DEFAULT_ALIAS
  
  
  class LanguageRouter(routers.BaseRouter):
  
      def for_read(self, **hints):
          language = get_language()
          if language not in settings.HAYSTACK_CONNECTIONS:
              return DEFAULT_ALIAS
          return language
  
      def for_write(self, **hints):
          language = get_language()
          if language not in settings.HAYSTACK_CONNECTIONS:
              return DEFAULT_ALIAS
          return language
  
new_contents: # -*- coding: utf-8 -*-
  from django.conf import settings
  from cms.utils.i18n import get_current_language
  
  from haystack import routers
  from haystack.constants import DEFAULT_ALIAS
  
  
  class LanguageRouter(routers.BaseRouter):
  
      def for_read(self, **hints):
          language = get_current_language()
          if language not in settings.HAYSTACK_CONNECTIONS:
              return DEFAULT_ALIAS
          return language
  
      def for_write(self, **hints):
          language = get_current_language()
          if language not in settings.HAYSTACK_CONNECTIONS:
              return DEFAULT_ALIAS
          return language
  
subject: Switch Django get_language for CMS get_current_language to avoid Django issue https://code.djangoproject.com/ticket/9340