def get_language(self, language_code, site_id=None):
        """
        Return the language settings for the current site

        This function can be used with other settings variables
        to support modules which create their own variation of the ``PARLER_LANGUAGES`` setting.
        For an example, see :func:`~parler.appsettings.add_default_language_settings`.
        """
        if language_code is None:
            # This happens when using parler in management commands.
            # Use translation.activate('en') if you need to have a default locale active.
            if get_language() is None:
                raise ValueError("language_code can't be null, use translation.activate(..) when accessing translated models outside the request/response loop.")
            else:
                raise ValueError("language_code can't be null")

        if site_id is None:
            site_id = getattr(settings, 'SITE_ID', None)

        for lang_dict in self.get(site_id, ()):
            if lang_dict['code'] == language_code:
                return lang_dict

        # no language match, search for variant: fr-ca falls back to fr
        for lang_dict in self.get(site_id, ()):
            if lang_dict['code'].split('-')[0] == language_code.split('-')[0]:
                return lang_dict

        return self['default']
dataset/ETHPy150Open edoburu/django-parler/parler/utils/conf.py/LanguagesSetting.get_language/original