User "Platonides" posted a comment on MediaWiki.r102205.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/102205#c25658
Commit summary:

[TsIntuition] Minor fixes in acceptableLanguages()
* Adding an example of the static utility function to demo/demo6
* Moving the function out of the TsIntuition class into TsIntuitionUtil where 
the other static utility functions are, renaming to getAcceptableLanguages
* Improving documentation/variable naming a little bit
* Whitespace / curly braces fixes
* Although I'm not 100% sure about this, I've added a FIXME about the q-val 
defaulting to 1. It needs a look-ahead technique to be more solid, right now 
low-level accept-languages are getting too high. Example:
-- code
getAcceptableLanguages: ( 'nl-be,nl;q=0.7,en-us,en;q=0.3' ):
array(4) {
  ["nl-be"]=>
  string(1) "1" // should be 0.7
  ["en-us"]=>
  string(1) "1" // should be 0.3
  ["nl"]=>
  string(3) "0.7"
  ["en"]=>
  string(3) "0.3"
}
-- /code
See demo6 for more this in action

* Follows-up r100234

Comment:

The relevant standard I followed is rfc 2616. The most relevant piece 

(from section 14.4) would be:
 Each language-range MAY be given an associated quality value 
 which represents an estimate of the user's preference for the 
 languages specified by that range. The quality value defaults to "q=1".

If you find the standard to imply otherwise, please share.



Now to the Firefox behavior: I couldn't reproduce it.

When I add nl, en-us and en in Firefox languages, I get
 nl,en-us;q=0.7,en;q=0.3
which is consistent with what I expected.

Ordering, 'nl, en-us, en' it's
 nl,en-us;q=0.7,en;q=0.3

Setting also nl-be:
 nl-be,nl;q=0.8,en-us;q=0.5,en;q=0.3

How did you get "nl-be,nl;q=0.7,en-us,en;q=0.3" from Firefox interface?


I looked for a Firefox bug like that, but didn't find it.

Yet, there are some interesting ones like 
[https://bugzilla.mozilla.org/show_bug.cgi?id=55800 55800] or 

[https://bugzilla.mozilla.org/show_bug.cgi?id=58034 58034: Accept-Language 
header needs q values] which 

supports my view in the opening comment:
 You can change the priority of the languages within the preferences, but no q
 values are attached to each language. Thus, true content negotiators such as
 mod_negotiation in Apache view all languages as being preferred equally, as
 according to HTTP/1.1 (IE properly adds q values to the languages)

That bug follows to the patch adding q-values, with 
[https://bugzilla.mozilla.org/show_bug.cgi?id=58034#c7 comment 7] explaining

firefox algorithm for q-value assignation:
 1 is divided amongst the languages present. For
 example, if you have three languages, the first gets a q of 1.000, the second
 gets 0.667, the third gets 0.333.


I don't know how that unqvalued 'en-us' arrived to your Accept-Language header.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to