Opened 5 years ago

Closed 5 years ago

#30675 closed New feature (needsinfo)

Ignore ACCEPT_LANGUAGE header only on i18n prefixed url patterns

Reported by: Janez Kranjc Owned by: nobody
Component: Internationalization Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In the current version of django the localization middleware ignores the accept language header if any i18n prefixed url pattern exist. It should only ignore it if the active url pattern is prefixed.

This would allow the following usage:

  • Have i18n prefixed urls for a website
  • Allow accept language header for api views which are not prefixed

I am willing to write a patch for this if there it would be merged to django eventually.

Change History (2)

comment:1 by Janez Kranjc, 5 years ago

Version: 2.2master

comment:2 by Carlton Gibson, 5 years ago

Resolution: needsinfo
Status: newclosed

Hi Jenez,

Thanks for the report. I kind of see the use-case here but changes here are non-trivial, so I think we need to flesh out the proposal, probably on the DevelopersMailingList, before moving forwards. (This is a delicate area and there's lots of expertise available there.)

Some thoughts...

  • What's the exact use-case that's failing, and are the existing workarounds that we can use? (Custom middleware... Setting active language etc...)
  • There's a long history for the Internationalization component, and open tickets around get_language_from_path() and ..._request() etc. Are these related?
  • What would the proposed change look like and what breaking changes would be involved?

The need here is just to flesh out what's involved. I hope that makes sense.

Note: See TracTickets for help on using tickets.
Back to Top