Code

Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#7831 closed (fixed)

get_language_from_request should be case-insensitive while matching settings.LANGUAGES

Reported by: bear330 Owned by: nobody
Component: Internationalization Version: master
Severity: Keywords: locale, language, case, middleware
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

HTTP_ACCEPT_LANGUAGE sent by browser will be different from its vendor or OS,
for example:
In XP, IE(6 or 7) will send zh-tw, in Vista it will be zh-TW
But firefox2 in some machine will send zh-tw or zh-TW,
In firefox3, it will send zh-tw always. (In my machine).

This will cause this line in trans_real.py failed:

            if lang not in supported:
                continue

It should compare it with case-insensitive way to fulfill all situations.

Thanks.

Attachments (1)

7831.patch (533 bytes) - added by bear330 6 years ago.
Simple patch to fix that.

Download all attachments as: .zip

Change History (5)

Changed 6 years ago by bear330

Simple patch to fix that.

comment:1 Changed 6 years ago by Karen Tracey <kmtracey@…>

  • milestone set to 1.0
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by ebruning

  • Has patch set

comment:3 Changed 6 years ago by jacob

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

(In [8561]) Fixed #7831: be case-insensitive when in get_language_from_request.

comment:4 Changed 3 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.