[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#157734: workaround for wrong Accept-Language headers



Please see my original report. The behaviour doesn't appear to have changed:

% wget -q http://www.debian.org/ --header="Accept-Language: en-ca, fr" -O - | grep html\ lang
<html lang="fr">
% wget -q http://www.debian.org/ --header="Accept-Language: en, fr" -O - | grep html\ lang
<html lang="en">

We want the first user priority to be honored, even if we can't satisfy it
in a specific manner.

A partial workaround is possible with this mod_headers command:

RequestHeader edit Accept-Language "(^\s*|,\s*)(\w\w)-(\w\w)([^,]*)(,|$)" "$1$2-$3$4, $2$4$5" early

This adds the corresponding generic language after the first non-generic language, e.g "en-us" will become "en-us, en", or "en-us; q=0.4" will become "en-us; q=0.4, en; q=0.4".

This is only a partial workaround since it will only do what you want if the languages are sorted with highest preference first (which need not be the case). I don't know how many browsers do this, but maybe you want to try it? At least for iceweasel it seems to work.

A complete fix would be possible with some global-edit command (which does not exist yet).

Without the "early" keyword, the rule is applied several times in case of sub-requests (I think this is a bug).



Reply to: