Opened 8 years ago

Closed 6 years ago

#3907 closed (fixed)

LocaleMiddleware allows locale from user browser that don't exists in settings.py

Reported by: nmariz@… Owned by: nobody
Component: Internationalization Version: master
Severity: Keywords: locale browser
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:

Description

LocaleMiddleware allows locale from user browser that don't exists in settings.py of the project.
More details in: http://groups.google.com/group/django-users/browse_thread/thread/57181b3407383e6c/7e06278858e2007b

Attachments (2)

trans_real.py (17.1 KB) - added by nmariz@… 8 years ago.
Patch for disabling locate from client browser to be loaded if doesn't exists in settings.py
trans_real.py.diff (581 bytes) - added by nmariz@… 8 years ago.
I think is that you want. Sorry, I'm new to svn.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 8 years ago by nmariz@…

  • Has patch set
  • Keywords browser added
  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset

A simple patch is to accept the mainlang(if supported) if the lang is not supported:
File: django/utils/translation/real_trans.py

[...]
def get_language_from_request(request):
[...]
    for lang, mainlang, order in langs:
        if lang in supported or mainlang in supported:
            # If the lang is not supported but mainlang is, than activate mainlang
            if not lang in supported and mainlang in supported:
                lang = mainlang
[...]

comment:2 Changed 8 years ago by Simon G. <dev@…>

  • Triage Stage changed from Unreviewed to Accepted

Hi Nuno, can you attach a patch of the above changes? (svn diff > output.diff) this makes it much easier for us to plug in and use :)

Changed 8 years ago by nmariz@…

Patch for disabling locate from client browser to be loaded if doesn't exists in settings.py

Changed 8 years ago by nmariz@…

I think is that you want. Sorry, I'm new to svn.

comment:3 Changed 6 years ago by ramiro

  • Resolution set to fixed
  • Status changed from new to closed

This was fixed by r6608.

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