lazd / mdn.io

The "I'm feeling lucky" URL shortener
http://mdn.io
215 stars 9 forks source link

Use Accept-Language to determine the language parameter to pass to search engines #5

Open lazd opened 10 years ago

lazd commented 10 years ago

The Accept-Language header should be used to determine the language to restrict search results to.

See Accept-Language RFC and Google's language collection values.

DuckDuckGo seems to support the kl and kad parameters that serve a similar function. These should be investigated as well.

simevidas commented 10 years ago

Yes, great idea. Reading the Accept-Language header and writing a corresponding lr value for Google is doable. Btw, I've checked in my browser (English version of Firefox) for a couple of sites, and the Accept-Language value that the browser is sending is "en-US;en;q=0.5".

Alhadis commented 2 years ago

I second this. Currently, [mdn.io/Error.prototype.stack](http://mdn.io/Error.prototype.stack) points to the German version of the page, despite my browser sending Accept-Language: en-AU,en-GB;q=0.7,en;q=0.3 as an HTTP header. I also confirmed that DuckDuckGo's "Language" setting was set to "Browser preferred default" in the Settings page).

Also, all variations of English can safely be mapped to en-US, since that's the only regional variant of English that MDN supports. 🙄