logoalt Hacker News

brainwad • yesterday at 4:01 PM • 1 reply • view on HN

The quality values here seem pretty generically tied to the order, so shaving them off probably wouldn't help? I presume they are there at all to let you express ties?


Replies

boomlinde • yesterday at 5:27 PM

It seems so, but I don't know that all browsers map quality values to order of preference in the same way.

I don't know about expressing ties. If there really is a tie and the client is just as happy to receive either language of equal Q, then it doesn't matter to the client that one is consistently preferred over another. Perhaps it could matter to the server if e.g. the client indicated that "en" and "zh" are tied, but the "en" content can be served in fewer bytes than it can serve the "zh" content, but it seems like such a niche use case.

edit: RFC 9110 offers an explanation: "Note that some recipients treat the order in which language tags are listed as an indication of descending priority, particularly for tags that are assigned equal quality values (no value is the same as q=1). However, this behavior cannot be relied upon. For consistency and to maximize interoperability, many user agents assign each language tag a unique quality value while also listing them in order of decreasing quality."

➕ show 1 reply