

@property
def regex(self):
    "\n        For non-default language always returns regex with langauge prefix.\n        For default language returns either '', eigher '^{lang_code}/',\n        depending on SOLID_I18N_HANDLE_DEFAULT_PREFIX and request url.\n\n        If SOLID_I18N_HANDLE_DEFAULT_PREFIX == True and default langauge\n        prefix is present in url, all other urls will be reversed with default\n        prefix.\n        Otherwise, all other urls will be reversed without default langauge\n        prefix.\n        "
    language_code = get_language()
    handle_default_prefix = getattr(settings, 'SOLID_I18N_HANDLE_DEFAULT_PREFIX', False)
    if (language_code not in self._regex_dict):
        if (language_code != settings.LANGUAGE_CODE):
            regex = ('^%s/' % language_code)
        elif handle_default_prefix:
            if (get_language_from_path() == settings.LANGUAGE_CODE):
                self.compiled_with_default = True
                regex = ('^%s/' % language_code)
            else:
                self.compiled_with_default = False
                regex = ''
        else:
            regex = ''
        self._regex_dict[language_code] = re.compile(regex, re.UNICODE)
    elif (handle_default_prefix and (language_code == settings.LANGUAGE_CODE)):
        language_from_path = get_language_from_path()
        regex = None
        if (handle_default_prefix.compiled_with_default and (not language_from_path)):
            regex = ''
            self.compiled_with_default = False
        elif ((not self.compiled_with_default) and (language_from_path == settings.LANGUAGE_CODE)):
            regex = ('^%s/' % language_code)
            self.compiled_with_default = True
        if (regex is not None):
            clear_url_caches()
            self._regex_dict[language_code] = re.compile(regex, re.UNICODE)
    return self._regex_dict[language_code]

dataset/ETHPy150Open st4lk/django-solid-i18n-urls/solid_i18n/urlresolvers.py SolidLocaleRegexURLResolver.regex/VarMisuse@168/412 `self`->`handle_default_prefix`