#37086: `set_language` silently fails when `next` URL prefix differs from active
language cookie
-------------------------------------+-------------------------------------
     Reporter:  Bugy Future          |                    Owner:  Jason
                                     |  Judkins
         Type:  Bug                  |                   Status:  assigned
    Component:                       |                  Version:  6.0
  Internationalization               |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
  LocalePrefixPattern,               |
  set_language,                      |
  get_language_from_path(),  i18n    |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  1
-------------------------------------+-------------------------------------
Changes (by Jason Judkins):

 * cc: Jason Judkins (added)
 * needs_tests:  0 => 1
 * owner:  (none) => Jason Judkins
 * stage:  Unreviewed => Accepted
 * status:  new => assigned

Comment:

 Reproduced on Django 6.05 / Python 3.12 with the reporter's minimal setup.

  Confirmed translate_url returns the original URL unchanged because
 LocalePrefixPattern.match rejects /fr/... while get_language() returns the
 cookie value zh-hans.

 [[Image()]]

  Worth discussing whether the fix belongs in translate_url itself rather
 than set_language — the function's contract suggests it should derive the
 source language from the URL it's translating rather than relying on
 caller-set context."
-- 
Ticket URL: <https://code.djangoproject.com/ticket/37086#comment:1>
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019dfed26668-679462f6-5ba7-45a7-8573-2e1738bd3c29-000000%40eu-central-1.amazonses.com.

Reply via email to