# Path: modeltrans/conf.py
# def get_available_languages(include_default=True):
#     """
#     Returns a tuple of available languages for django-modeltrans.
#     """
#     MODELTRANS_AVAILABLE_LANGUAGES = get_available_languages_setting()
# 
#     if include_default:
#         return tuple(
#             set(itertools.chain(MODELTRANS_AVAILABLE_LANGUAGES, (get_default_language(),)))
#         )
#     else:
#         return MODELTRANS_AVAILABLE_LANGUAGES
# 
# def get_default_language():
#     return settings.LANGUAGE_CODE


import django
from django.core.exceptions import FieldDoesNotExist
from django.db.models.constants import LOOKUP_SEP
from django.db.models.lookups import Transform
from django.utils.translation import get_language as _get_language
from .conf import get_available_languages, get_default_language
    from django.db.models.fields.json import KeyTransform
    from django.contrib.postgres.fields.jsonb import KeyTransform


try:
except ImportError:


DJANGO_VERSION = django.get_version()


def get_language():
    """
    Return an active language code that is guaranteed to be in settings.LANGUAGES

    (Django does not seem to guarantee this for us.)
    """
    lang = _get_language()
    if lang in get_available_languages():
        return lang

# Path: modeltrans/conf.py
# def get_available_languages(include_default=True):
#     """
#     Returns a tuple of available languages for django-modeltrans.
#     """
#     MODELTRANS_AVAILABLE_LANGUAGES = get_available_languages_setting()
# 
#     if include_default:
#         return tuple(
#             set(itertools.chain(MODELTRANS_AVAILABLE_LANGUAGES, (get_default_language(),)))
#         )
#     else:
#         return MODELTRANS_AVAILABLE_LANGUAGES
# 
# def get_default_language():
#     return settings.LANGUAGE_CODE


# Path: modeltrans/utils.py
import django
from django.core.exceptions import FieldDoesNotExist
from django.db.models.constants import LOOKUP_SEP
from django.db.models.lookups import Transform
from django.utils.translation import get_language as _get_language
from .conf import get_available_languages, get_default_language
    from django.db.models.fields.json import KeyTransform
    from django.contrib.postgres.fields.jsonb import KeyTransform



try:
except ImportError:


DJANGO_VERSION = django.get_version()


def get_language():
    """
    Return an active language code that is guaranteed to be in settings.LANGUAGES

    (Django does not seem to guarantee this for us.)
    """
    lang = _get_language()
    if lang in get_available_languages():
        return lang

    return get_default_language()