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.
(*urls, prefix_default_language=True)
| 6 | |
| 7 | |
| 8 | def i18n_patterns(*urls, prefix_default_language=True): |
| 9 | """ |
| 10 | Add the language code prefix to every URL pattern within this function. |
| 11 | This may only be used in the root URLconf, not in an included URLconf. |
| 12 | """ |
| 13 | if not settings.USE_I18N: |
| 14 | return list(urls) |
| 15 | return [ |
| 16 | URLResolver( |
| 17 | LocalePrefixPattern(prefix_default_language=prefix_default_language), |
| 18 | list(urls), |
| 19 | ) |
| 20 | ] |
| 21 | |
| 22 | |
| 23 | @functools.cache |
searching dependent graphs…