Closed Bug 1237661 Opened 8 years ago Closed 8 years ago

the admin switches locales between refreshes

Categories

(developer.mozilla.org Graveyard :: General, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: robhudson, Assigned: willkg)

References

Details

(Keywords: in-triage)

If you go into the admin and refresh any of the admin pages a few times, it'll switch locales: text that's been translated, the way dates are formatted, etc.
Assignee: nobody → robhudson
Severity: normal → minor
Keywords: in-triage
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/002f83aa97f695deb1471535fadb556027689b97
Fix bug 1237661 - Correct order of middleware for locales and sessions

https://github.com/mozilla/kuma/commit/f87cee970ec89773807bb25d65da44a7af3e3aed
Merge pull request #3739 from robhudson/admin-locale-fix

Fix bug 1237661 - Correct order of middleware for locales and sessions
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
See Also: → 1215125
Rob did a deploy this morning, but the problem is still occurring so I'm reopening.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Side effect of this which makes the problem more serious:

If you're editing a user's information (adding them to a group, for example), and then try to save the page, and the locale randomly changes on you to one whose date format is different, your save is blocked and you get an error message telling you to correct your invalid date.

This can result in frustration of having to try over and over until finally it accepts your change.
I'm snatching this from Rob. I just spent a bunch of time on Input looking into it, figured out the problem and fixed it there. Pretty sure it's the same cause in MDN.
Assignee: robhudson → willkg
It's the same issue that Input had. Yay!

In a PR: https://github.com/mozilla/kuma/pull/3785
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/c10ae65546447fb7a349e1c618e71d8656d4ac6c
Fix bug 1237661: Fix wonky admin

This fixes the wonky admin problem where the language of the admin would
change between refreshes.

What's going on is that Django 1.8 introduced a fix to
trans_real.activate where if you pass in '', it does nothing and
returns. The prefixer will set the locale to '' for /admin/, so then
the locale-aware middleware calls translation.activate('') and
suddenly we're all standing in a pool of goo in the middle ages with
flaming arrows aimed at us.

This fixes that.

https://github.com/mozilla/kuma/commit/67bb93dce75750f1fef6e14d48c99202e4eda525
Merge pull request #3785 from mozilla/1237661-admin

Fix bug 1237661: Fix wonky admin
Status: REOPENED → RESOLVED
Closed: 8 years ago8 years ago
Resolution: --- → FIXED
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.