Closed Bug 643641 Opened 13 years ago Closed 13 years ago

Twitter Party: locale detection doesn't recognize some locales in the ab-cd form

Categories

(www.mozilla.org :: General, defect)

defect
Not set
critical

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: stas, Assigned: andre)

References

Details

Attachments

(2 files)

If the country part is given in the Accept Language header, the locale detection is broken -- it moves to the next locale in the header.

I have a working patch.
Here's an example of this behavior:

> $ curl -sI -H'Accept-Language: en-us,en;q=0.7,ar;q=0.3' http://dev2.twitterparty.quodis.com/ | grep Location
> Location: http://dev2.twitterparty.quodis.com/ar
Attached patch PatchSplinter Review
The issue was that once we got into the `if ($this->mapLonglocales == true)` part, the break statement would only break from the smaller loop (foreach ($this->supportedLocales as $var)), but the bigger loop would continue checking the next preferred locale in the Accept Language header.
Assignee: nobody → stas
Attachment #520811 - Flags: review?(pascalc)
Comment on attachment 520811 [details] [diff] [review]
Patch

looks good to me and is a simplification of my code
Attachment #520811 - Flags: review?(pascalc) → review+
Reassigning to Andre to commit to the repo.
Assignee: stas → andre
commited

updated in http://dev2.twitterparty.quodis.com/
and http://dev.twitterparty.quodis.com/

does it really fix? I think an issue with the white list still remains.
> curl -sI -H'Accept-Language: en-us,en;q=0.7,ar;q=0.3' http://dev2.twitterparty.quodis.com/ | grep Location
> Location: http://dev2.twitterparty.quodis.com/en-US

I think this is fixed now.

I would appreciate a thorough QA, though.  FWIW, I tested with more combinations of the Accept Language header and it looked good.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Verified FIXED:

ohwhatagooseiam:~ stephendonner$ curl -sI -H'Accept-Language: en-us,en;q=0.7, ar;q=0.3' http://twitterparty.mozilla.org | grep Location
Location: http://twitterparty.mozilla.org/en-US
Status: RESOLVED → VERIFIED
The fix for this was lost in a merge from the master branch:

https://github.com/quodis/Twitter-Collage/commit/882bbf6a5ca6cf4bd93df012f2177774deb88d3a#diff-1
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
done

updated on our server:

curl -sI -H'Accept-Language: en-us,en;q=0.7,ar;q=0.3'
http://dev-m.twitterparty.quodis.com/ | grep Location

also marked Bug 645851 as Fixed
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
Verified on quodis:
curl -sI -H'Accept-Language: es,en;q=0.7,ar;q=0.3' http://dev-m.twitterparty.quodis.com/ | grep Location

Location: http://dev-m.twitterparty.quodis.com/es
Verified on twittercollage.allizom.org
curl -sI -H'Accept-Language: es,en;q=0.7,ar;q=0.3' http://twittercollage.allizom.org/| grep Location

Location: http://twittercollage.allizom.org/es
Status: RESOLVED → VERIFIED
Component: www.mozilla.org/firefox → www.mozilla.org
Component: www.mozilla.org → General
Product: Websites → www.mozilla.org
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: