django.urls.LocalePrefixPattern

Here are the examples of the python api django.urls.LocalePrefixPattern 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 GNU General Public License v3.0
from Aghoreshwar

def i18n_patterns(*urls, prefix_default_language=True):
    """
    Add 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)
    return [
        URLResolver(
            LocalePrefixPattern(prefix_default_language=prefix_default_language),
            list(urls),
        )
    ]


@functools.lru_cache(maxsize=None)