Opened 17 years ago

Closed 14 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: dev
Severity: Keywords: locale browser
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

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@… 17 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@… 17 years ago.
I think is that you want. Sorry, I'm new to svn.

Download all attachments as: .zip

Change History (5)

comment:1 by nmariz@…, 17 years ago

Has patch: set
Keywords: browser added
Needs tests: set

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 by Simon G. <dev@…>, 17 years ago

Triage Stage: UnreviewedAccepted

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 :)

by nmariz@…, 17 years ago

Attachment: trans_real.py added

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

by nmariz@…, 17 years ago

Attachment: trans_real.py.diff added

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

comment:3 by Ramiro Morales, 14 years ago

Resolution: fixed
Status: newclosed

This was fixed by r6608.

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