django.urls.LocaleRegexURLResolver

Here are the examples of the python api django.urls.LocaleRegexURLResolver taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

3 Source : i18n.py
with MIT License
from chunky2808

def i18n_patterns(*urls, **kwargs):
    """
    Adds the language code prefix to every URL pattern within this
    function. This may only be used in the root URLconf, not in an included
    URLconf.
    """
    if not settings.USE_I18N:
        return list(urls)
    prefix_default_language = kwargs.pop('prefix_default_language', True)
    assert not kwargs, 'Unexpected kwargs for i18n_patterns(): %s' % kwargs
    return [LocaleRegexURLResolver(list(urls), prefix_default_language=prefix_default_language)]


@lru_cache.lru_cache(maxsize=None)