#30272: get_language_from_path not respecting i18n_patterns prefix_default_language=False ------------------------------------------------+------------------------ Reporter: Stefan Wehrmeyer | Owner: nobody Type: Bug | Status: new Component: Internationalization | Version: 2.1 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | ------------------------------------------------+------------------------ Starting in Django 1.10 `django.conf.urls.i18n.i18n_patterns` accepts an option `prefix_default_language` that can be set to `False`. This adds no language prefix for the the default language when reversing URLs.
`django.utils.translation.get_language_from_path` is supposed to detect the language from the URL path. At the moment it returns `None` when no language URL prefix is found. I would argue that if the path is resolved by `i18n_patterns` with `prefix_default_language=False` `get_language_from_path` should return the default language (`settings.LANGUAGE_CODE`) I believe the intention of using `i18n_patterns` and setting `prefix_default_language=False` is two-fold: - construct URLs in the default language without a language prefix (this works now) - detect non-prefixed URLs as using the default language (currently *not* working, falls back to session, cookie, HTTP headers) Let me know if you consider this a bug. -- Ticket URL: <https://code.djangoproject.com/ticket/30272> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.4e5b3b4f0ca774a0e2287b10b2d5b1ea%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.